terraform-stacks
Comprehensive guide for creating, validating, and managing Terraform Stack configurations across environments.
- Covers Stack language fundamentals: component definitions (.tfcomponent.hcl), deployment instances (.tfdeploy.hcl), file organization, and required Terraform v1.13+
- Supports multi-region and multi-environment deployments using for_each on providers and components, with automatic dependency inference between components
- Includes workload identity (OIDC) authentication, identity token blocks, variable sets via store blocks, and deployment groups with auto-approval rules
- Provides CLI commands for initialization, validation, configuration upload, and deployment monitoring; includes HCP Terraform API guidance for programmatic monitoring in automation
- Documents common patterns (component dependencies, deferred changes, linked Stacks), best practices for module compatibility and state isolation, and troubleshooting for circular dependencies and destruction workflows
Terraform Stacks
Terraform Stacks simplify infrastructure provisioning and management at scale by providing a configuration layer above traditional Terraform modules. Stacks enable declarative orchestration of multiple components across environments, regions, and cloud accounts.
Core Concepts
Stack: A complete unit of infrastructure composed of components and deployments that can be managed together.
Component: An abstraction around a Terraform module that defines infrastructure pieces. Each component specifies a source module, inputs, and providers.
Deployment: An instance of all components in a stack with specific input values. Use deployments for different environments (dev/staging/prod), regions, or cloud accounts.
Stack Language: A separate HCL-based language (not regular Terraform HCL) with distinct blocks and file extensions.
File Structure
Terraform Stacks use specific file extensions:
- Component configuration:
.tfcomponent.hcl
More from hashicorp/agent-skills
terraform-style-guide
Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.
4.5Kterraform-test
Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating infrastructure behavior with assertions, mocking providers and data sources, testing module outputs and resource configurations, or troubleshooting Terraform test syntax and execution.
2.8Krefactor-module
Transform monolithic Terraform configurations into reusable, maintainable modules following HashiCorp's module design principles and community best practices.
2.2Kprovider-resources
Implement Terraform Provider resources and data sources using the Plugin Framework. Use when developing CRUD operations, schema design, state management, and acceptance testing for provider resources.
1.4Kterraform-search-import
Discover existing cloud resources using Terraform Search queries and bulk import them into Terraform management. Use when bringing unmanaged infrastructure under Terraform control, auditing cloud resources, or migrating to IaC.
1.4Knew-terraform-provider
Use this when scaffolding a new Terraform provider.
1.3K