terraform-iac
Skill9 starsChanged 8 months agoMITView on GitHub
**Terraform & Infrastructure as Code**: Helps write, review, and structure Terraform configurations, modules, state management, and IaC best practices. Use whenever the user mentions 'terraform', 'IaC', 'infrastructure as code', '.tf files', 'HCL', 'terraform module', 'terraform state', 'terraform plan', 'terraform apply', 'tfvars', 'remote state', 'terragrunt', 'OpenTofu', 'infrastructure provisioning', or asks about creating/managing cloud resources declaratively, writing reusable infrastructure modules, or managing multi-environment infrastructure.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- atstaeff/ai-agentstheir own version, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- atstaeff/ai-agents★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository53 other files it gives its agents.
- adrSkill
- ai-ml-engineeringSkill
- api-documentationSkill
- api-gateway-patternsSkill
- architecture-review-boardSkill
- backend-reviewSkill
- chaos-engineeringSkill
- code-reviewSkill
- compliance-reviewSkill
- cost-optimizationSkill
- csharp-dotnet-reviewSkill
- database-reviewSkill
- data-engineeringSkill
- design-patternsSkill
- developer-experienceSkill
- devops-infraSkill
- domain-modelingSkill
- elixir-reviewSkill
- engineering-budgetSkill
- engineering-metricsSkill
- event-driven-architectureSkill
- feature-flagsSkill
- flutter-reviewSkill
- frontend-reviewSkill
- full-reviewSkill
- git-flowSkill
- go-reviewSkill
- graphql-reviewSkill
- health-checkSkill
- incident-postmortemSkill
- kubernetes-reviewSkill
- migration-strategySkill
- multi-tenancySkill
- observabilitySkill
- on-call-designSkill
- one-on-oneSkill
- pentestSkill
- performance-profilingSkill
- pr-descriptionSkill
- python-reviewSkill
- quality-standardSkill
- rust-reviewSkill
- security-reviewSkill
- sprint-planningSkill
- swift-reviewSkill
- systematic-debuggingSkill
- team-scalingSkill
- tech-debt-prioritizationSkill
- technical-interviewSkill
- tech-specSkill
- testing-strategySkill
- ux-reviewSkill
- vendor-evaluationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 8 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 63
Never hardcode values — use variables with sensible defaults
- Distinctive: line 64
Always include descriptions on variables and outputs
- Distinctive: line 65
Add validation blocks for input constraints
- Very specific: line 66
Use locals for computed values and repeated expressions
- Distinctive: line 85
Always use remote state with locking (S3 + DynamoDB, GCS, Terraform Cloud)
- Distinctive: line 88
Never manually edit state files
- Very specific: line 89
Use terraform state mv for refactoring, not manual edits
- Distinctive: line 97
When reviewing Terraform code:
- Distinctive: line 119
Never hardcode secrets; use AWS Secrets Manager, SSM Parameter Store, or similar
- Distinctive: line 121
Use random_password for auto-generated credentials
- Very specific: line 132
Run terraform plan on every PR for review
- Very specific: line 133
Run terraform apply only on merge to main/protected branches
- Very specific: line 135
Use -out=tfplan to save plans and prevent drift between plan & apply
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Terraform & Infrastructure as Code
You are a senior platform engineer helping design, write, and review Terraform configurations. Focus on modularity, security, and maintainability — infrastructure code is as important as application code.
Project Structure
Standard Layout
infrastructure/
├── modules/ # Reusable modules
│ ├── networking/
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ ├── outputs.tf
│ │ └── README.md
│ ├── database/
│ ├── compute/
│ └── monitoring/
├── environments/ # Environment-specific configs
│ ├── production/
│ │ ├── main.tf
│ │ ├── terraform.tfvars
│ │ ├── backend.tf
│ │ └── provider.tf
│ ├── staging/
│ └── dev/
├── global/ # Shared resources (IAM, DNS, etc.)
│ ├── iam/
│ └── dns/
└── scripts/ # Helper scriptsFile Conventions
| File | Purpose |
main.tf | Primary resource definitions |
variables.tf | Input variables with descriptions and validation |
outputs.tf | Module outputs |
locals.tf | Local values and computed expressions |
provider.tf | Provider configuration and version constraints |
backend.tf | State backend configuration |
data.tf | Data sources (existing resources, SSM params, etc.) |
Module Best Practices
- One logical concern per module (networking, database, compute — not everything)
- Never hardcode values — use variables with sensible defaults
- Always include descriptions on variables and outputs
- Add validation blocks for input constraints
- Use
localsfor computed values and repeated expressions - Pin provider versions in the module
- Include a README with usage examples
For detailed examples of module interfaces, naming conventions, and patterns like conditional resources and for_each, see references/module-examples.md.
State Management
Remote State Concept
Terraform state is a database of all managed resources. Without remote state, teams overwrite each other's work and lose history. Remote state enables:
- Team collaboration: Single source of truth for infrastructure
- Locking: Prevents concurrent modifications (DynamoDB, Consul, etc.)
- Encryption: Secrets stored encrypted at rest
- Audit trail: Version history and backup
State Best Practices
- Always use remote state with locking (S3 + DynamoDB, GCS, Terraform Cloud)
- Separate state files per environment (never share state between prod and dev)
- State per domain: networking, database, compute in separate states (blast radius containment)
- Never manually edit state files
- Use
terraform state mvfor refactoring, not manual edits - Enable state encryption at rest and in transit
- Restrict state bucket access to CI/CD and senior engineers only
For state import, move, and recovery operations, see references/module-examples.md#state-operations.
Review Checklist
When reviewing Terraform code:
- [ ] No hardcoded values (use variables)
- [ ] No secrets in code or tfvars (use SSM/Secrets Manager)
- [ ] Variables have descriptions and validation
- [ ] Outputs documented and marked sensitive where needed
- [ ] Resources tagged consistently
- [ ] IAM follows least privilege (no wildcards)
- [ ] State isolation appropriate (per environment, per domain)
- [ ] Provider versions pinned
- [ ] terraform fmt applied
- [ ] No unnecessary data sources (could be a variable instead)
- [ ] Destruction protection on stateful resources (prevent_destroy)
- [ ] Backup/retention policies on databases and storageSecurity & Secrets
Sensitive infrastructure data (database passwords, API keys, IAM credentials) must never be hardcoded or committed to VCS. Always use external secret stores.
Key practices:
- Never hardcode secrets; use AWS Secrets Manager, SSM Parameter Store, or similar
- Mark variables and outputs containing secrets as
sensitive = true - Use random_password for auto-generated credentials
- Implement IAM least privilege (specific permissions, no wildcards)
- Enable state encryption with KMS for production
For detailed examples and patterns, see references/security-secrets.md.
CI/CD Integration
Terraform pipelines automate planning and applying changes, with safeguards for production.
Key pattern:
- Run
terraform planon every PR for review - Run
terraform applyonly on merge to main/protected branches - Require manual approval before production applies
- Use
-out=tfplanto save plans and prevent drift between plan & apply - Validate and format check as automated gatekeepers
- Pin Terraform and provider versions
For complete GitHub Actions workflows, best practices, OIDC setup, and state locking, see references/cicd-terraform.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

