Terraform Stacks
Writes Terraform Stacks configurations for HCP Terraform: components in .tfcomponent.hcl, deployments in .tfdeploy.hcl, OIDC identity tokens, auto-approve rules, linked Stacks and API monitoring. Use when building or debugging a Stack.
terraform-stacks- Author
- HashiCorp
- Source
- hashicorp/agent-skills/plugins/terraform/skills/terraform-stacks @ 5e30fa5
- License
- MPL-2.0
About this skill
What it does
The skill covers the Terraform Stacks language, a configuration layer above modules that HCP Terraform runs. A Stack is components (each wraps a module from a local path, a registry or git) and deployments (one set of inputs per environment, region or account, 1 to 20 per Stack). It spells out what differs from plain Terraform: files are .tfcomponent.hcl and .tfdeploy.hcl at the repository root, variables need a type and take no validation, provider blocks carry the alias in the header, a config block and for_each, outputs need a type, and modules used as components may not contain provider blocks.
On the deployment side it covers identity_token for OIDC (its preferred way to authenticate), store "varset" for HCP variable sets, deployment_group and deployment_auto_approve rules (Premium tier; orchestrate is deprecated), and publish_output with upstream_input to link Stacks. The CLI needs Terraform 1.13 or later, pinned in a .terraform-version file: terraform stacks init, validate, fmt, then configuration upload, which starts deployment runs; there is no plan or apply. Removing a deployment takes destroy = true, an upload and an approval.
Six files sit in references/: component-blocks.md and deployment-blocks.md list every block and argument, linked-stacks.md covers cross-Stack outputs, examples.md has complete multi-region, multi-cloud and linked Stacks, troubleshooting.md covers common errors, and api-monitoring.md polls the HCP Terraform API with curl and jq, since the CLI watch commands never return and hang automation. It needs an HCP Terraform API token from ~/.terraform.d/credentials.tfrc.json or an environment variable.
When to use it, and when not
Use it to write or fix Stack configurations, roll modules out to several environments and regions, or follow deployment runs.
Without HCP Terraform it has nothing to run on; an ordinary root module needs the style guide.
How to run it
We do not copy this skill: its files are under MPL-2.0, a file-level copyleft licence outside the set we copy under. Install it from HashiCorp's repository with the button to the source: one skill via npx skills add hashicorp/agent-skills/plugins/terraform/skills/terraform-stacks, or the whole terraform plugin, in Claude Code claude plugin marketplace add hashicorp/agent-skills and claude plugin install terraform@hashicorp. In Codex: codex plugin marketplace add hashicorp/agent-skills, then install terraform from /plugins and start a new session. In Claude Code, the plugin's skill may appear as /terraform:terraform-stacks.
- Claude Code:
/terraform-stacks, or ask for the skill by name. - Codex:
$terraform-stacks. - Cursor: type
/in the Agent chat and pickterraform-stacks.
Example: /terraform-stacks Turn modules/vpc and modules/app into a Stack with dev and prod deployments in two AWS regions, authenticated with OIDC.
How it differs from similar skills
Nothing outside this pack covers Stacks. Terraform style guide sets conventions for regular HCL, and several of them do not carry over: Stack variables cannot have validation and providers are written differently. Refactor Terraform into modules produces the modules that Stack components then wrap.
Install
This skill is not copied to the catalog: its licence allows a copy only under the same licence, and the catalog does not copy under such licences. Install it from the author's repository.
Connect through AnyModel API
This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.
AnyModel