Comprehensive Terraform and OpenTofu best practices skill for Claude Code. Get instant guidance on testing strategies, module patterns, CI/CD workflows, and production-ready infrastructure code.
π§ͺ Testing Frameworks
- Decision matrix for choosing between native tests and Terratest
- Testing strategy workflows (static β integration β E2E)
- Real-world examples and patterns
π¦ Module Development
- Structure and naming conventions
- Versioning strategies
- Public vs private module patterns
π CI/CD Integration
- GitHub Actions workflows
- GitLab CI examples
- Cost optimization patterns
- Compliance automation
π Security & Compliance
- Trivy, Checkov integration
- Policy-as-code patterns
- Compliance scanning workflows
π Quick Reference
- Decision flowcharts
- Common patterns (β DO vs β DON'T)
- Cheat sheets for rapid consultation
This plugin is distributed via Claude Code marketplace using .claude-plugin/marketplace.json.
/plugin marketplace add antonbabenko/terraform-skill
/plugin install terraform-skill@antonbabenko# Clone to Claude skills directory
git clone https://github.com/antonbabenko/terraform-skill ~/.claude/skills/terraform-skillWhile the repository is private, you can test locally:
git clone git@github.com:antonbabenko/terraform-skill.git ~/.claude/skills/terraform-skill
# Claude Code will load it from the local filesystemAfter installation, try:
"Create a Terraform module with testing for an S3 bucket"
Claude will automatically use the skill when working with Terraform/OpenTofu code.
Create a module with tests:
"Create a Terraform module for AWS VPC with native tests"
Review existing code:
"Review this Terraform configuration following best practices"
Generate CI/CD workflow:
"Create a GitHub Actions workflow for Terraform with cost estimation"
Testing strategy:
"Help me choose between native tests and Terratest for my modules"
Decision matrices for:
- When to use native tests (Terraform 1.6+)
- When to use Terratest (Go-based)
- Multi-environment testing patterns
- Naming conventions (
terraform-<PROVIDER>-<NAME>) - Directory structure best practices
- Input variable organization
- Output value design
- Version constraint patterns
- Documentation standards
- GitHub Actions examples
- GitLab CI templates
- Atlantis integration
- Cost estimation (Infracost)
- Security scanning (Trivy, Checkov)
- Compliance checking
- Static analysis integration
- Policy-as-code patterns
- Secrets management
- State file security
- Compliance scanning workflows
Side-by-side β DO vs β DON'T examples for:
- Variable naming
- Resource naming
- Module composition
- State management
- Provider configuration
Based on Production Experience:
- Patterns from terraform-best-practices.com
- Community-tested approaches from terraform-aws-modules
- AWS Hero expertise in enterprise IaC
- Real-world usage across 100+ modules
Version-Specific Guidance:
- Terraform 1.0+ features
- OpenTofu 1.6+ compatibility
- Native test framework (1.6+)
- Current tooling ecosystem (2024-2026)
Decision Frameworks: Not just "what to do" but "when and why" - helping you make informed architecture decisions.
- Claude Code or other Claude environment supporting skills
- Terraform 1.0+ or OpenTofu 1.6+
- Optional: MCP Terraform server for enhanced registry integration
See CLAUDE.md for:
- Skill development guidelines
- Content structure philosophy
- How to propose improvements
- Testing and validation approach
Issues & Feedback: GitHub Issues
Releases are automated based on conventional commits in commit messages:
| Commit Type | Version Bump | Example |
|---|---|---|
feat!: or BREAKING CHANGE: |
Major | 1.2.3 β 2.0.0 |
feat: |
Minor | 1.2.3 β 1.3.0 |
fix: |
Patch | 1.2.3 β 1.2.4 |
| Other commits | Patch (default) | 1.2.3 β 1.2.4 |
Releases are created automatically when changes are pushed to master.
- Terraform Language - HashiCorp official docs
- Terraform Testing - Native test framework
- OpenTofu Documentation - OpenTofu official docs
- HashiCorp Best Practices - Cloud best practices
- Awesome Terraform
- Terraform Best Practices - Comprehensive guide (base for this skill)
- terraform-aws-modules - Production-grade AWS modules
- Terratest - Go testing framework for Terraform
- Google Cloud Best Practices
- AWS Terraform Best Practices
- pre-commit-terraform - Pre-commit hooks for Terraform
- terraform-docs - Generate documentation from Terraform modules
- terraform-switcher - Terraform version manager
- TFLint - Terraform linter
- Trivy - Security scanner for IaC
License: Apache 2.0 - see LICENSE
If you create derivative works or skills based on this skill, please include:
Based on terraform-skill by Anton Babenko
https://github.com/antonbabenko/terraform-skill
terraform-best-practices.com | Compliance.tf