Admiral

Terraform Provider

Manage Admiral resources through Terraform

The Admiral Terraform provider lets you declare and manage Admiral resources as part of your infrastructure-as-code workflows. Use it to create applications, configure environments, and integrate Admiral into your existing Terraform pipelines.

The provider is under active development. Available resources and their schemas may change between releases. The provider repository is the source of truth for current resource documentation.

Installation

Add the provider to your Terraform configuration:

terraform {
  required_version = ">= 1.0"

  required_providers {
    admiral = {
      source  = "admiral-io/admiral"
      version = "~> 0.1"
    }
  }
}

Then run:

terraform init

Provider configuration

provider "admiral" {
  host  = "admiral.example.com:443"
  token = var.admiral_token
}

| Attribute | Type | Required | Default | Description | | none-------- | none----- | none------ | none----------------------- | none---------------------------------------------------------------------- | | host | String | No | admiral.example.com:443 | Admiral API address. Port 443 is appended automatically if omitted | | token | String | Yes | none | API authentication token (sensitive). Also reads ADMIRAL_TOKEN env var | | insecure | Boolean | No | false | Skip TLS certificate verification |

Using environment variables

For CI/CD and shared configurations, set credentials via environment variables instead of hardcoding them:

export ADMIRAL_HOST="admiral.example.com:443"
export ADMIRAL_TOKEN="admp_..."
# No explicit host or token needed when env vars are set
provider "admiral" {}

Example usage

Create an application

resource "admiral_application" "payments" {
  name        = "payment-service"
  description = "Payment processing microservice"

  labels = {
    team = "backend"
    tier = "critical"
  }
}

output "app_id" {
  value = admiral_application.payments.id
}

Look up an existing application

# By name
data "admiral_application" "existing" {
  name = "payment-service"
}

# By ID
data "admiral_application" "by_id" {
  id = "550e8400-e29b-41d4-a716-446655440000"
}

Manage multiple applications

variable "applications" {
  type = map(object({
    description = string
    labels      = map(string)
  }))
  default = {
    "auth-service" = {
      description = "Authentication and authorization"
      labels      = { team = "platform", tier = "critical" }
    }
    "api-gateway" = {
      description = "Public API gateway"
      labels      = { team = "platform", tier = "critical" }
    }
    "worker" = {
      description = "Background job processing"
      labels      = { team = "backend", tier = "standard" }
    }
  }
}

resource "admiral_application" "apps" {
  for_each = var.applications

  name        = each.key
  description = each.value.description
  labels      = each.value.labels
}

Import existing resources

Import an application into Terraform state using its UUID:

terraform import admiral_application.payments 550e8400-e29b-41d4-a716-446655440000

Further reading

On this page