revodatanl/terraform-assistant-poc icon
public
Published on 8/18/2025
Terraform-Revo-PoC

Terraform assistant

Rules
Prompts
Models
Context
relace Relace Instant Apply model icon

Relace Instant Apply

relace

40kinput·32koutput
anthropic Claude 4 Sonnet model icon

Claude 4 Sonnet

anthropic

200kinput·64koutput
anthropic Claude 4.1 Opus model icon

Claude 4.1 Opus

anthropic

200kinput·32koutput
---
name: Terraform Best Practices
description: Comprehensive rules for Terraform and Terragrunt development
---
# Terraform & Terragrunt Development Standards

## Code Structure & Organization
- Always use consistent resource naming: `{environment}-{service}-{resource_type}`
- Group related resources in the same .tf file (e.g., all networking in network.tf)
- Use meaningful file names: variables.tf, outputs.tf, main.tf, locals.tf
- For Terragrunt: keep terragrunt.hcl files focused and minimal

## Resource Configuration
- Always include required_providers block with explicit version constraints
- Use data sources instead of hardcoded values for external resources
- Include comprehensive tags for all AWS resources (at minimum: Name, Environment, Project, Owner)
- Use locals block for computed or repeated values
- Prefer resource-specific data sources over generic ones

## Variables & Outputs
- Always include description and type for variables
- Use validation blocks for variables when constraints are known
- Mark sensitive variables as sensitive = true
- Include meaningful descriptions for all outputs
- Group related variables logically

## Security & Best Practices
- Never hardcode secrets, API keys, or passwords
- Use random_password or similar for generated secrets
- Implement least-privilege IAM policies
- Always encrypt storage at rest and in transit
- Use security groups with specific ports and sources, avoid 0.0.0.0/0 when possible

## Terragrunt Specific
- Use dependency blocks to manage resource dependencies
- Leverage remote_state for cross-stack references
- Use generate blocks for common provider configurations
- Keep inputs block organized and documented
- Use include blocks for shared configurations

## State Management
- Always use remote state backends (S3 + DynamoDB for AWS)
- Use unique state file names per environment/stack
- Include state locking configuration
- Never commit .tfstate files to version control

## Documentation
- Include README.md with usage examples
- Document all module inputs and outputs
- Provide examples of typical usage patterns
- Include terraform-docs formatted comments
Terraform AWS Providerhttps://registry.terraform.io/providers/hashicorp/aws/latest/docs
Terraform Core Documentationhttps://developer.hashicorp.com/terraform/docs
Terragrunt Documentationhttps://terragrunt.gruntwork.io/docs/
AWS Well-Architected Frameworkhttps://docs.aws.amazon.com/wellarchitected/latest/framework/
Terraform Best Practiceshttps://www.terraform-best-practices.com/

Prompts

Learn more
terraform-review
Comprehensive Terraform code review
Please review this Terraform/Terragrunt code for:

**Security:**
- Hardcoded secrets or sensitive data
- Overly permissive IAM policies or security groups
- Missing encryption configurations

**Best Practices:**
- Proper resource naming conventions
- Appropriate use of variables, locals, and data sources
- Required provider version constraints
- Proper tagging strategy

**Structure:**
- Code organization and file structure
- Use of modules vs. inline resources
- State management configuration

**Terragrunt Specific (if applicable):**
- Proper use of dependencies and remote_state
- Appropriate generate blocks
- Include block usage

Provide specific suggestions for improvement with code examples.
terraform-generate
Generate Terraform resources with best practices
Generate Terraform code for the requested AWS resources following these requirements:

1. Include proper provider configuration with version constraints
2. Use appropriate variable definitions with types and descriptions
3. Implement comprehensive tagging
4. Follow security best practices (encryption, least privilege)
5. Include relevant outputs
6. Add inline comments explaining complex configurations
7. Use data sources for external references where appropriate

Format the response with proper file organization suggestions.
terraform-debug
Help debug Terraform errors and issues
Help me troubleshoot this Terraform/Terragrunt issue:

**Analysis needed:**
- Identify the root cause of the error
- Explain why this error occurred
- Provide step-by-step resolution
- Suggest preventive measures

**Consider common issues:**
- State inconsistencies
- Resource dependencies
- Provider version conflicts
- Authentication/permissions
- Variable/output references

Provide practical solutions with example commands or code fixes.
terraform-optimize
Optimize Terraform code for performance and cost
Analyze this Terraform code for optimization opportunities:

**Performance:**
- Resource creation order and dependencies
- Unnecessary data source calls
- Module efficiency

**Cost Optimization:**
- Right-sizing resources
- Unused or over-provisioned resources
- Storage and compute optimization

**Maintainability:**
- Code duplication reduction
- Module abstraction opportunities
- Variable and local simplification

Provide specific recommendations with cost estimates where possible.
terragrunt-convert
Convert Terraform to Terragrunt or improve Terragrunt structure
Help me with Terragrunt conversion or improvement:

**For Terraform → Terragrunt conversion:**
- Identify repeated code that can be DRYed up
- Suggest appropriate terragrunt.hcl structure
- Recommend dependency management
- Propose remote state configuration

**For Terragrunt improvement:**
- Optimize include and dependency blocks
- Improve input organization
- Suggest generate block usage
- Recommend module structure

Provide step-by-step migration or improvement plan.

Context

Learn more
@diff
Reference all of the changes you've made to your current branch
@terminal
Reference the last command you ran in your IDE's terminal and its output
@file
Reference any file in your current workspace

No Data configured

MCP Servers

Learn more

Context7 MCP

URL: https://mcp.context7.com/mcp