[MODEL] Claude Code degrades from autonomous engineer to passive writer/builder on Infrastructure as Code tasks
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Claude made incorrect assumptions about my project
What You Asked Claude to Do
I asked Claude Code (Opus 4.6) to help provision a new Terraform-managed infrastructure (AWS EC2, S3, IAM, etc.) for a customer-facing product. The work involved: destroying old resources, creating new Terraform state, running terraform apply, setting up CI/CD workflows, and configuring secrets.
What Claude Actually Did
On coding tasks (Python, TypeScript), Claude autonomously designs, implements, tests, and iterates. On this IaC session, Claude consistently:
- Became a passive HCL writer / command builder / log analyzer — wrote Terraform code and assembled CLI commands, but relied on the human for all decisions, sequencing, and quality checks
- Failed to anticipate cross-cutting impacts — disabled modules (
.tf.disabled) but missed thatoutputs.tfandgithub-oidc.tfstill referenced them, causingterraform planto fail - Stated incorrect infrastructure facts with confidence — claimed EC2
user_dataruns "on every boot" (it only runs on first launch via cloud-init), and suggestedterminate + terraform applyinstead ofterraform apply -replace - Missed naming convention inconsistencies — failed to notice that a CI/CD secret name didn't follow the namespace convention that was being enforced everywhere else
- Failed to predict git merge propagation — didn't foresee that a temporary
prevent_destroy = falsechange merged tomainwould propagate to a renamed directory via auto-merge in another PR - Required human prompting for basic workflow — didn't commit and push changes until explicitly told to do so
The human partner had to serve as architect, quality reviewer, and decision-maker for every step, while Claude only executed atomic sub-tasks.
Expected Behavior
Claude should operate on IaC tasks with the same level of autonomy it demonstrates on coding tasks:
- Anticipate side effects: When disabling
.tffiles, proactively check all references (outputs, other modules, OIDC policies) - Verify facts before stating them: Check cloud-init documentation or
user_databehavior before asserting execution timing - Apply established conventions: If a naming convention is being enforced across resources, apply it consistently to all artifacts including CI/CD secrets
- Think through git operations: Predict how merging one PR's changes will affect another PR's files
- Drive the workflow: Commit, push, and proceed to next steps without waiting to be told
Permission Mode
Accept Edits was ON (auto-accepting changes)
Can You Reproduce This?
Yes, every time with the same prompt
Steps to Reproduce
- Ask Claude Code to help with a multi-step Terraform provisioning task (create/destroy resources, manage state, configure CI/CD)
- Observe that Claude writes correct HCL syntax but fails to anticipate infrastructure-level side effects
- Observe that the human must drive every decision while Claude only executes atomic sub-tasks
Claude Model
Opus
Relevant Conversation
The session involved ~2 hours of Terraform work. Key moments where Claude required human correction:
- Human: "What about the old backend?" → Claude hadn't considered the existing Terraform state
- Human: "Every time we use
-targetfeels wrong, isn't there a better way?" → Claude hadn't thought of.tf.disabledrenaming - Human: "Why didn't you squash? Why didn't you commit and push?" → Claude waited for explicit instructions on basic git workflow
- Human: "Doesn't
user_dataonly run on creation, not on boot?" → Claude had stated the opposite with confidence - Human: "Isn't it
terraform apply -replace, not terminate + apply?" → Claude suggested the less appropriate approach
Impact
Medium - Extra work to undo changes
Claude Code Version
2.1.62 (Claude Code)
Platform
Anthropic API
Additional Context
Structural analysis: why IaC tasks degrade
On coding tasks, Claude can run an autonomous loop: write code → execute tests → read errors → fix → repeat. The feedback loop is fast and stays within code.
On IaC tasks, every basic operation is a combination of multiple knowledge domains (Terraform HCL + AWS behavior + git operations + CI/CD + state management). The results manifest outside the code (real AWS resources, state files, cloud-init execution timing). Claude cannot simulate these real-world outcomes, so the autonomous loop breaks and the human becomes the loop driver.
This is not about Terraform syntax knowledge — Claude writes HCL fluently. It's about the inability to simulate what happens when terraform apply runs against real infrastructure, when git merge combines changes from different PRs, or when cloud-init processes user_data.
Related issues
- #27589 — Claude contradicted its own Terraform migration plan, causing data loss via
terraform apply - #23732 — Claude failed to follow logical implications during Terraform debugging, requiring 2 days of human guidance
- #27607 — Claude hesitates on non-software-engineering tasks (system prompt bias toward "software engineering tasks")
✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗