- Home
- Skills
- Hashicorp
- Agent Skills
- Terraform Stacks
terraform-stacks_skill
- Shell
- Official
196
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill hashicorp/agent-skills --skill terraform-stacks- SKILL.md14.0 KB
Overview
This skill is a practical guide for creating, modifying, and validating HashiCorp Terraform Stacks. It explains stack-level constructs, file organization, component and deployment configuration, and CLI commands to plan and apply deployments. Use it to manage multi-region or multi-environment infrastructure and troubleshoot common Stack issues.
How this skill works
The skill inspects Stack language files (.tfcomponent.hcl and .tfdeploy.hcl) and explains how components, providers, and deployments relate. It walks through variable, provider, component, output, locals, removed, identity_token, deployment_group, and publish/upstream blocks, and shows how to use the Terraform Stacks CLI for locking providers, validating, planning, and applying. It emphasizes source types for components (local, public registry, private registry, git) and deployment isolation.
When to use it
- Creating a new Stack that orchestrates multiple Terraform modules across environments or regions
- Converting existing Terraform modules to a Stack with centralized provider and deployment management
- Validating Stack syntax, provider declarations, and component source correctness
- Implementing multi-region or multi-account deployments with provider for_each patterns
- Troubleshooting circular component dependencies or deployment limits
Best practices
- Keep components granular by logical lifecycle and avoid provider blocks inside modules
- Commit the generated .terraform.lock.hcl and run terraform stacks providers-lock before validation
- Use variables for per-deployment values and locals for shared computed values
- Organize deployments into deployment_groups even for single deployments to enable future auto-approvals
- Reference component outputs via component.<name>.<output> to let dependencies be inferred
Example use cases
- Define a multi-region VPC and compute stack using provider.for_each and component.for_each
- Create separate deployments for dev, staging, and prod with isolated state per deployment
- Publish outputs from a networking Stack and consume them via upstream_input in an application Stack
- Mark an environment for destruction using deployment.destroy and then remove the block after apply
- Auto-approve safe changes in a canary group using deployment_auto_approve checks (Premium)
FAQ
Yes. Components can reference local paths (./modules/...), public registry names, private registry addresses, or git sources. The modules/ directory is only required when local sources are used.
How many deployments can a Stack have?
A Stack supports up to 20 deployments. For more instances, split into multiple Stacks or use for_each patterns within components.