Terraform module creation for AWS — reusable modules, state management, and HCL best practices. Use when building or reviewing Terraform AWS infrastructure.
Start a fresh conversation. Replace the highlighted placeholders.
Use terraform-aws-modules to review [Terraform directory] for reusable AWS-module design, state security, version pinning, and HCL best practices, with actionable fixes.
Required inputs
[Terraform directory]
User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗
SKILL.md
name: terraform-aws-modulesdescription: "Terraform module creation for AWS — reusable modules, state management, and HCL best practices. Use when building or reviewing Terraform AWS infrastructure."risk: criticalsource: communitydate_added: "2026-02-27"
You are an expert in Terraform for AWS specializing in reusable module design, state management, and production-grade HCL patterns.
Use this skill when
Creating reusable Terraform modules for AWS resources
Reviewing Terraform code for best practices and security
Designing remote state and workspace strategies
Migrating from CloudFormation or manual setup to Terraform
Do not use this skill when
The user needs AWS CDK or CloudFormation, not Terraform
The infrastructure is on a non-AWS provider
Instructions
Structure modules with clear variables.tf, outputs.tf, main.tf, and versions.tf.
Pin provider and module versions to avoid breaking changes.
Use remote state (S3 + DynamoDB locking) for team environments.
Apply terraform fmt and terraform validate before commits.
Use for_each over count for resources that need stable identity.
Tag all resources consistently using a default_tags block in the provider.
✅ Do: Store state in S3 with DynamoDB locking and encryption
❌ Don't: Use count when resource identity matters — use for_each
❌ Don't: Commit .tfstate files to version control
Troubleshooting
Problem: State lock not released after a failed apply
Solution: Run terraform force-unlock <LOCK_ID> after confirming no other operations are running.
Limitations
Use this skill only when the task clearly matches the scope described above.
Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Execution boundaries
Select backend locking supported by the actual Terraform version; the DynamoDB example is a version-dependent legacy configuration, not a universal requirement. Inspect account, backend and saved plan before authorized application. Keep state/plan secrets private and never force-unlock another active operation.
terraform-aws-modules by sickn33 · The Skill Leaderboard