Skip to content

HCP Terraform ​

The hcp-terraform target sets workspace variables in HCP Terraform or Terraform Enterprise through the variables API. It updates the variable with the same key and category, or creates one.

Config typehcp-terraform
RequiresAn API token that can write the workspace's variables
Readable afterwardsNo while sensitive = true (the default)

Quick start ​

toml
[targets.tfc-prod]
type = "hcp-terraform"
organization = "acme"
workspace = "prod"
category = "env"

[secrets]
AWS_SECRET_ACCESS_KEY = { provider = "op", value = "AWS/prod secret", push = ["tfc-prod"] }

Configuration ​

FieldDefaultDescription
urlhttps://app.terraform.ioBase URL of HCP Terraform or your Terraform Enterprise instance.
organizationrequiredOrganization that owns the workspace.
workspacerequiredWorkspace name.
categoryrequired"terraform" for an input variable, "env" for an environment variable.
sensitivetrueWrite the value once and never show it again.
hclfalseParse the value as HCL instead of a string.
descriptionnoneDescription shown in HCP Terraform.

Authentication ​

fnox uses the first token it finds:

  1. TF_TOKEN_<host>, the variable Terraform itself reads, such as TF_TOKEN_app_terraform_io. Periods in the host become _ and hyphens become __.
  2. TFE_TOKEN.
  3. The token terraform login saved in ~/.terraform.d/credentials.tfrc.json (%APPDATA%\terraform.d\credentials.tfrc.json on Windows).

Notes ​

  • HCP Terraform does not let a sensitive variable become non-sensitive, so sensitive = false fails for a variable that is already sensitive.
MIT LicenseCopyright © 2026jdx.dev