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.)

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.