Skip to content
GantryCD

Variables

Stack variables become environment variables in every run. Use TF_VAR_* names for OpenTofu inputs and normal names for settings read by providers or scripts.

Add variables

Use variable for plain values and secret for sensitive values:

resource "gantrycd_stack_environment_variables" "payments" {
  stack_id = gantrycd_stack.payments.id

  # exclusive = true

  variable {
    key   = "TF_VAR_environment"
    value = "production"
  }

  secret {
    key              = "API_TOKEN"
    value            = var.payments_api_token
    value_wo_version = 1
  }
}

GantryCD encrypts secret values and does not return them. The provider also keeps value out of Terraform state.

Rotate a secret

Change the secret value and increase value_wo_version. The version tells the provider to send the new value without storing it in state.

Own every variable

exclusive defaults to false, so the resource manages only the keys it declares. Set it to true when the resource should own the stack’s full variable set. Any other key is then removed on apply.

Use contexts to share variables across stacks.