terraform-dependency-analyzerlisted
Install: claude install-skill Backura/fastagent-plugins
# Terraform Dependency Analyzer
This skill helps analyze and optimize resource dependencies in Terraform configurations.
## When to Use
Use this skill when:
- Understanding resource relationships and dependencies
- Troubleshooting circular dependency errors
- Optimizing resource creation order
- Refactoring complex configurations
- Documenting infrastructure dependencies
## Dependency Types
### Implicit Dependencies
Terraform automatically detects dependencies through resource attribute references:
- Most common and preferred method
- Created when one resource references another's attributes
- Example: `subnet_id = aws_subnet.main.id`
### Explicit Dependencies
Use `depends_on` only when implicit dependencies aren't sufficient:
- Cross-resource timing requirements
- Dependencies not expressed through attributes
- Ensuring proper creation/deletion order
- Should be used sparingly
## Analysis Workflow
### 1. Generate Dependency Graph
```bash
# Create visual dependency graph
terraform graph | dot -Tpng > graph.png
# View as text
terraform graph
```
### 2. Identify Resource Relationships
Parse configuration to map dependencies:
- Read through resource definitions
- Note attribute references between resources
- Identify explicit `depends_on` declarations
- Map out dependency chains
### 3. Check for Circular Dependencies
**Common causes:**
- Security groups with mutual ingress rules
- Resources referencing each other's attributes
- Module outputs creating circular re