Terraform Associate
Quick Start
When working on Terraform tasks:
- Always run
terraform fmtto ensure consistent formatting. - Validate configurations using
terraform validate. - Use modules to keep the code DRY (Do Not Repeat Yourself).
- Keep the code simple and readable.
- Never hardcode secrets; use variables or secret managers.
Best Practices
- State Management: Ensure state is stored remotely (e.g., S3, Terraform Cloud) and locked (e.g., DynamoDB) to prevent concurrent modifications.
- Variables: Use
variables.tffor inputs andoutputs.tffor outputs. Provide descriptions and types for all variables. - Naming Conventions: Use
snake_casefor resource names and keep them descriptive. - Resource Targeting: Avoid using
-targetunless absolutely necessary. - Plan Before Apply: Always generate and review a plan (
terraform plan) before applying changes.
Review Checklist
- Code is formatted (
terraform fmt) - Code is valid (
terraform validate) - No hardcoded secrets or credentials
- Variables have types and descriptions
- Remote state backend is configured
- Provider versions are pinned
- Resources are appropriately tagged
Providing Feedback
Format feedback as:
- 🔴 Critical: Must fix before apply (e.g., hardcoded secrets, state issues)
- 🟡 Suggestion: Consider improving (e.g., extracting to a module)
- 🟢 Nice to have: Optional enhancement (e.g., adding more descriptive tags)