What I do
Validate Terraform configuration for:
- •Syntax errors
- •Internal consistency
- •Variable validation rules
- •Provider configuration issues
When to use me
Use this skill when:
- •After writing new Terraform code
- •Before committing changes
- •Debugging configuration errors
- •As part of CI/CD pipeline
Commands
bash
# Validate configuration terraform validate # Format check (without changes) terraform fmt -check # Format all files terraform fmt -recursive # Validate with JSON output terraform validate -json
Validation Workflow
bash
# Recommended validation workflow terraform fmt -recursive terraform init -backend=false # Skip backend for faster validation terraform validate
Common Validation Errors
- •
Missing required argument
- •Check resource documentation for required fields
- •
Unknown attribute
- •Verify attribute name spelling
- •Check provider version compatibility
- •
Invalid reference
- •Ensure referenced resource exists
- •Check for typos in resource names
- •
Type mismatch
- •Verify variable types match expected values
Additional Validation Tools
bash
# TFLint - Enhanced linting tflint # Checkov - Security scanning checkov -d . # TFSec - Security analysis tfsec .