Generate Terraform infrastructure
Draft a reviewable module with variables, outputs, tagging and a working usage example.
Intermediate40 minCOMMUNITY ANALYSISTerraformtflintcheckov
Prompt
Write a Terraform module for {resource} targeting Terraform >= 1.6.
Rules: no hardcoded credentials or regions, every environment-specific value is a variable, all resources tagged, outputs for everything a consumer needs, README with a usage example.
List every IAM permission the module requires and why.Problem
Ad-hoc infrastructure code creates drift and over-broad IAM.
Goal
A tagged, documented module with least-privilege IAM.
Context
A cloud account with remote state and locking already configured.
Expected Output
Module files, example directory, README, IAM justification list.
Steps
- Describe the provider and region strategy
- Generate module and example
- Review IAM by hand
- Plan against a sandbox account
Validation
- `terraform validate`
- `tflint`
- `checkov`
- Plan review
Security Considerations
- Generated IAM policies trend towards wildcards — rewrite them
- Never run `apply` unattended
Lessons Learned
- The README example exposes bad variable design instantly
Related prompts