Skip to main content
By default, sensitive values like tfy_api_key are stored directly in terraform.tfvars. While convenient for initial setup, this is a security risk if the file is committed to version control.
Terraform only reads from the secrets backend. You are responsible for creating and updating the secrets outside of Terraform.

Supported Backends

How It Works

Every backend follows the same pattern:
  1. A use_remote_credentials variable (default true) controls whether secrets are read from the remote store or fall through to terraform.tfvars.
  2. Data sources are gated with count = var.use_remote_credentials ? 1 : 0 — when disabled, no remote calls are made.
  3. A locals block resolves tfy_api_key from either the remote store or var.tfy_api_key.
  4. main.tf references local.tfy_api_key — it does not need to change when you switch backends.

Migration Guide

Pick the tab that matches your secrets infrastructure and follow the steps.
  • AWS IAM permissions — the identity running Terraform needs:
    • secretsmanager:GetSecretValue
    • secretsmanager:DescribeSecret
1

Create the secret in AWS Secrets Manager

Before running Terraform, manually create a secret in AWS Secrets Manager. The secret value must be a JSON object containing all the credentials you want to manage:
Via the AWS Console:
  1. Open AWS Secrets Manager → click Store a new secret.
  2. Choose Other type of secret.
  3. Select Plaintext and paste the JSON above (with your actual value).
  4. Name the secret (e.g. truefoundry/<your-cluster-name>/terraform-secrets).
  5. Complete the wizard and note the secret name.
2

Add secrets.tf

Create a file named secrets.tf in your Terraform root directory with the following contents:
secrets.tf
Add a line to locals for each key in your secret. The fallback variables (e.g. var.license_key) are only used when use_remote_credentials = false.
3

Configure terraform.tfvars

terraform.tfvars
4

Update main.tf and apply

Replace references to var.tfy_api_key with local.tfy_api_key (and similarly for any other secrets):
Then initialize and apply:

FAQ

Update the secret value directly in your secrets store (AWS Secrets Manager, SSM, Vault, or 1Password), then run tofu apply to propagate the new values.
All four backends support a quick fallback without removing secrets.tf. Set:
in your terraform.tfvars and provide the tfy_api_key value directly. The remote data source will be skipped entirely (count = 0) — no network calls to the secrets backend will be made.
  1. Replace the contents of secrets.tf with the new backend’s configuration from the relevant tab above.
  2. Update terraform.tfvars with the new backend’s variables and remove the old backend’s variables.
  3. Re-initialize and apply:
The secrets.tf file should contain only one backend’s configuration at a time.

Quick Reference