InfraDots logo
Documentation

InfraDots Terraform Provider

You can manage InfraDots workspaces, variables, and other resources using Terraform or OpenTofu — so your InfraDots setup itself is infrastructure as code.

Why use the provider?

  • GitOps for InfraDots — Define workspaces, VCS links, and variables in .tf files and apply changes via your normal pipeline
  • Consistency — Recreate or clone workspaces across environments (dev/staging/prod) from code
  • Automation — Create workspaces and variables when onboarding new projects or tenants

Setup

1. Provider requirement and configuration

Add the InfraDots provider to your Terraform/OpenTofu configuration:

terraform {
  required_providers {
    infradots = {
      source  = "infradots/infradots"
      version = "~> 1.0"   # use the version that matches the provider release
    }
  }
}

provider "infradots" {
  api_token = var.infradots_api_token
}

Keep your API token in a variable and set it via environment (e.g. TF_VAR_infradots_api_token) or a secure variable store — never commit it.

2. Create a workspace

variable "infradots_api_token" {
  type      = string
  sensitive = true
}

resource "infradots_workspace" "app_prod" {
  name         = "app-prod"
  organization = "my-org"

  vcs_repo {
    identifier = "my-org/infra-repo"
    branch     = "main"
  }
}

Adjust organization, identifier, and branch to match your InfraDots organization and repository.

3. Manage variables

Define workspace or organization variables in code:

resource "infradots_variable" "region" {
  workspace_id = infradots_workspace.app_prod.id
  key          = "region"
  value        = "us-east-1"
  category     = "terraform"
}

resource "infradots_variable" "db_password" {
  workspace_id = infradots_workspace.app_prod.id
  key          = "db_password"
  value        = var.db_password
  category     = "terraform"
  sensitive    = true
}

(Exact resource names and arguments may differ — check the provider documentation for your version.)

4. Point agents at your own model account

infradots_model_provider records an account of your own, and infradots_organization_model_provider points the organization's agents at it. They are two resources because the provider belongs to the organization — setting it on infradots_organization would make the two depend on each other, the same reason infradots_organization_agent_pool is separate.

resource "infradots_model_provider" "bedrock" {
  organization_name = "my-org"
  name              = "our-bedrock"
  provider_type     = "bedrock" # or anthropic, vertex, foundry

  settings = {
    aws_region     = "eu-west-1"
    aws_access_key = var.aws_access_key
    aws_secret_key = var.aws_secret_key
  }

  model_map = {
    "claude-opus-5"   = "eu.anthropic.claude-opus-5-v1:0"
    "claude-sonnet-5" = "eu.anthropic.claude-sonnet-5-v1:0"
  }
}

resource "infradots_organization_model_provider" "ours" {
  organization_name = "my-org"
  model_provider_id = infradots_model_provider.bedrock.id
}

settings is write-only as a whole, because InfraDots cannot return the secret half of it. The non-secret half reads back under config, so a region changed outside Terraform shows up as drift; a rotated key cannot. Destroying infradots_organization_model_provider sends the organization's model calls back to InfraDots' own account. See Agents for what each provider_type accepts.

5. Administrators and teams

organization_admin on infradots_user and infradots_team makes a member, or every member of a team, an organization administrator. Leave it out and Terraform doesn't touch it, so importing the organization's creator as an infradots_user keeps them an administrator.

resource "infradots_user" "ops_lead" {
  organization_name  = "acme"
  email              = "[email protected]"
  organization_admin = true
}

resource "infradots_team" "platform" {
  organization_name  = "acme"
  name               = "platform-ops"
  organization_admin = false
}

Changing it needs the organization write permission. InfraDots refuses to demote or remove the last administrator. Switching a team's organization_admin off also clears its organization-level permissions; grant the ones it keeps with infradots_permission. See Organizations.

6. Plan policies

infradots_policy is a plan policy. Each kind's settings are attributes of their own, and setting another kind's is an error at plan time.

resource "infradots_policy" "owner_tag" {
  organization_name = "acme"
  name              = "Production must be tagged"
  kind              = "require_tags"
  required_tags     = ["owner", "cost-center"]
  enforcement       = "blocking"
  workspace_tags    = { env = "prod" }
}

resource "infradots_policy" "db_retention" {
  organization_name = "acme"
  name              = "Seven days of database backups"
  kind              = "attribute"
  resource_type     = "aws_db_instance"
  path              = "backup_retention_period"
  op                = "eq"
  value             = 7
}

value keeps its type, so 7 doesn't match "7". in and not_in take values, a list of strings, and no_open_ingress takes ports.

7. Agent skills

infradots_agent_skill adds a skill your agents load: inline instructions, or a skill directory in git that is pinned to the commit source_ref points to when it is saved. A skill named like a platform skill replaces it for your organization, and enabled = false turns the platform one off. It needs the write_agents permission.

resource "infradots_agent_skill" "tagging" {
  organization_name = "acme"
  name              = "tagging"
  display_name      = "Tagging"
  description       = "Required tags for every resource. Use when adding or changing resources."
  instructions      = file("${path.module}/skills/tagging.md")
  resource_types    = ["aws_*"]
}

resource "infradots_agent_skill" "no_scaffold" {
  organization_name = "acme"
  name              = "iac-module-scaffold"
  display_name      = "Module scaffold (off)"
  enabled           = false
}

description is one line of at most 128 characters; the skill's body goes in instructions. See Agents.

Where to find the provider

Getting an API token

Create an API token in InfraDots (e.g. from your account or organization settings) and pass it to the provider via api_token. Store the token in a secret manager or environment variable; do not commit it. Deleting the token in InfraDots revokes it at once: the next request with it gets 401.