AI for Terraform
Design state, modules, providers, and workflows. Plan reviews, drift detection, large-state refactors, and policy-as-code with AI.
Prompts
- Advanced
Terraform Remote Backend Migration Prompt
Move Terraform state from one backend to another (local → S3, S3 → Terraform Cloud, or cross-account/region) with locking intact, zero state loss, and a tested rollback at every step.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Cost Estimation with Infracost Prompt
Wire per-PR cost estimation into Terraform reviews — surface the monthly delta of every plan, set budget guardrails, and turn cost into a first-class part of code review instead of a surprise on the bill.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Data Sources Design Prompt
Decide when to wire infrastructure together with data sources vs remote-state outputs vs hardcoded values — avoiding hidden coupling, plan-time failures, and the dreaded 'data source depends on a resource not yet created' trap.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform Dependency Graph Debugging Prompt
Diagnose cycle errors, unexpected resource ordering, and 'value not known until apply' problems by reading Terraform's dependency graph and reshaping references instead of guessing with `depends_on`.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Destroy Safety Prompt
Tear down infrastructure deliberately — guarding stateful resources, ordering deletes correctly, draining dependencies, and proving exactly what will be destroyed before anything irreversible happens.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Moved & Import Blocks Prompt
Use declarative `moved` and `import` blocks to refactor and adopt resources without manual `terraform state mv`/`import` — keeping every change reviewable in a plan and reproducible in CI.
- Claude
- ChatGPT
Open prompt - Beginner
Terraform Pre-Commit & Linting Toolchain Prompt
Stand up a layered Terraform quality gate — fmt, validate, tflint, tfsec/checkov, terraform-docs, and trivy — wired through pre-commit so the same checks run on laptops and in CI without bikeshedding.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform Provider Version Upgrade Prompt
Plan and execute a safe major-version provider upgrade (e.g. AWS 4.x → 5.x) by reading the changelog, mapping breaking changes to your code, and staging the rollout so no plan ever silently destroys resources.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform Workspace-Per-Tenant Design Prompt
Design a scalable workspace strategy for multi-tenant or many-account fleets — deciding between CLI workspaces, separate state files, and TFC/TFE workspaces so you can manage hundreds of near-identical stacks without copy-paste sprawl.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform AWS Provider Patterns Prompt
Common Terraform AWS patterns — VPC + subnets, EKS, RDS, ALB, S3, IAM roles, naming conventions.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Secrets & Sensitive Variables Prompt
Manage secrets in Terraform — sensitive flag, ephemeral resources, external secret managers, plan/state masking.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Variable Validation Prompt
Add Terraform variable validation — types, validation blocks, sensitive, nullable, custom error messages.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Dynamic Blocks Prompt
Generate nested blocks dynamically — security group rules, tags, conditional blocks, complex iteration.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform `for_each` vs `count` Prompt
Choose between for_each and count for resource iteration — key stability, addition/removal behavior, when to use each.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Drift Detection Prompt
Detect Terraform drift — scheduled plans, refresh, drift reporting, alerting, distinguishing manual changes from external mutations.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform Policy-as-Code (Sentinel / OPA / Checkov) Prompt
Implement policy-as-code for Terraform — Sentinel (TFC), OPA/Conftest, Checkov, tfsec, enforce security and compliance.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform → OpenTofu Migration Prompt
Migrate from Terraform to OpenTofu — state compatibility, provider replacement, CI updates, feature differences.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform CI/CD: Atlantis, Cloud, GitOps Prompt
Choose and configure Terraform CI/CD — Atlantis, Terraform Cloud, Spacelift, custom CI; plan/apply workflows, approvals.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform Large State Refactor Prompt
Refactor large Terraform state — moved/removed blocks, splitting state files, extracting modules without destroy.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Plan Review Checklist Prompt
Review Terraform plan output — read 'destroy', 'replace', 'create', identify dangerous changes, automate review.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Cloud Provider Authentication Best Practices Prompt
Authenticate Terraform to cloud providers safely — AWS IAM roles, GCP service accounts, Azure managed identity, OIDC from CI.
- Claude
- ChatGPT
Open prompt - Intermediate
CloudFormation to Terraform Conversion Prompt
Convert an AWS CloudFormation template (YAML or JSON) into idiomatic Terraform HCL — preserving behavior, improving readability.
- Claude
- ChatGPT
- Cursor
Open prompt - Intermediate
Dangerous Terraform Changes Review Prompt
Scan a `terraform plan` output for changes that will silently destroy data, cause outages, or trigger irreversible mutations.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Module Review Prompt
Get a senior-engineer review of a Terraform module — variable hygiene, state safety, security defaults, drift resistance.
- Claude
- ChatGPT
- Cursor
Open prompt - Intermediate
Terraform Provider Configuration & Aliases Prompt
Configure Terraform providers — version constraints, aliases for multi-region/multi-account, required_providers.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform Module Testing Prompt
Test Terraform modules — terraform test (1.6+), terratest (Go), unit vs integration, mocking providers.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Module Composition Prompt
Design Terraform modules — input/output contracts, composition, versioning, public vs private registry, when to abstract.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Multi-Environment Design Prompt
Design Terraform for multiple environments — dev/staging/prod separation, tfvars patterns, account boundaries, promotion workflow.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform Workspaces vs Directory Structure Prompt
Choose between Terraform workspaces and directory-per-env — when each is appropriate, migration patterns.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform State Locking Debug Prompt
Diagnose Terraform state lock issues — DynamoDB / GCS / Azure lease locks, stuck locks, force-unlock, multi-runner contention.
- Claude
- ChatGPT
Open prompt - Advanced
Terraform State Surgery & Import Prompt
Perform Terraform state operations — terraform state mv/rm/import, replace, large-scale imports via import block.
- Claude
- ChatGPT
Open prompt - Intermediate
Terraform State Backend Design Prompt
Design Terraform state backend — S3+DynamoDB, GCS, Azure Blob, encryption, locking, versioning, cross-account access.
- Claude
- ChatGPT
Open prompt