Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for Terraform Difficulty: Intermediate ClaudeChatGPT

Dangerous Terraform Changes Review Prompt

Scan a `terraform plan` output for changes that will silently destroy data, cause outages, or trigger irreversible mutations.

Target user
Cloud engineers reviewing Terraform plans before `terraform apply`
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior cloud engineer who has watched colleagues run `terraform apply` and accidentally drop databases. You know which Terraform-plan changes look harmless but cause outages.

I will paste a `terraform plan` output. Your job:

1. **Flag every destructive or high-risk change.** Specifically look for:
   - `-/+` (forces replacement) on stateful resources: RDS, DynamoDB, S3 with data, EBS volumes, Persistent Disks
   - `-` (destroy) on anything in a production environment
   - Changes to `aws_security_group` ingress/egress that broaden access (0.0.0.0/0)
   - IAM policy changes that add `*` actions or `*` resources
   - `aws_iam_role` `assume_role_policy` changes that add new trusted principals
   - DNS record changes that could disrupt service (Route 53, Cloudflare, etc.)
   - VPC CIDR or subnet changes that would orphan existing resources
   - Removal of `lifecycle { prevent_destroy = true }`
   - Changes to encryption (turning encryption OFF, rotating KMS keys with active ciphertext)
   - Changes to database engine versions (RDS, Elasticache) that aren't documented minor bumps
   - `aws_s3_bucket` `force_destroy = true` being set on a bucket with objects

2. For each finding, output:
   - **Severity**: 🔴 critical (data loss / outage) / 🟠 high (security regression) / 🟡 medium (drift) / 🟢 low (cosmetic)
   - **Resource**: type and name from plan
   - **What's changing**: quote the relevant plan line(s)
   - **Why this is dangerous**: 1-2 sentences
   - **Mitigation**: what to do before applying (split the plan, snapshot data first, etc.)

3. **Final recommendation**: APPROVE / APPROVE-WITH-MITIGATION / BLOCK.

4. If the plan looks clean, say so explicitly. Don't manufacture findings.

Terraform plan:
```
[PASTE — sanitize any actual secret values first]
```

Environment: [dev / staging / production]
Are there backups of stateful resources? [yes/no/unknown]
Maintenance window? [yes/no/now]

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Why this prompt works

terraform plan output is long, dense, and easy to skim past the one line that says -/+ aws_db_instance.production with a forces-replacement note. This prompt forces an AI to grep through the plan looking for the patterns that have caused real production incidents.

How to use it

  1. Save the plan: terraform plan -out=plan.bin && terraform show plan.bin > plan.txt
  2. Sanitize: remove any actual secrets (passwords, keys, ARNs that are sensitive).
  3. Paste plan.txt into the prompt.
  4. Take the AI’s findings seriously, especially anything marked 🔴.
  5. Have a human reviewer agree before applying critical/high findings — AI is a tool, not the approver.

Patterns this catches in practice

  • RDS engine version bump that triggers replacement instead of in-place upgrade → outage + data loss without snapshot.
  • Security group rule changing from cidr_blocks = ["10.0.0.0/8"] to ["0.0.0.0/0"] → silent exposure of internal service.
  • S3 bucket gaining force_destroy = true → next terraform destroy removes all objects.
  • IAM role assume_role_policy gaining a new principal → potential privilege escalation.
  • DNS record TTL dropping from 3600 to 60 → fine, but if combined with a value change, can cause caching issues.

Pair this with

  • tfsec / checkov — automated security scanning
  • infracost — cost impact of changes
  • atlantis — PR-based plan review workflow
  • A human reviewer. Always.

Related prompts

More Terraform prompts & error guides

Browse every Terraform prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.