Prompt

Why is my Terraform plan different in dev and prod?

Technology / Cloud Infrastructure2 observationsLast seen Nov 11, 2026

Latest observation

Nov 11, 2026OpenAI APIWeb search: off

Terraform plans differ between dev and prod for a few common reasons. The short version: Terraform plans are driven by the combination of configuration, input values, provider behavior, and the current real-world state. If any of those differ, the plan can differ.

Common reasons

1) Different variables or environment-specific values

Dev and prod often use different:

  • *.tfvars files
  • workspace names
  • environment variables
  • module inputs

Examples:

  • different instance sizes
  • different counts
  • different CIDRs/subnets
  • different tags or naming prefixes

2) Different remote state or current resource state

If dev and prod point to different backends or state files, Terraform will compare against different existing infrastructure.

Also, if someone manually changed prod resources outside Terraform, the plan may show drift.

3) Different provider versions

If dev and prod use different Terraform provider versions, the plan can change because providers may:

  • default fields differently
  • normalize values differently
  • introduce breaking changes

Check:

  • required_providers
  • .terraform.lock.hcl
  • CI vs local installed versions

4) Different Terraform versions

Terraform CLI version differences can affect:

  • expression evaluation
  • provider interaction
  • plan formatting
  • handling of null/unknown values

5) Data sources returning different values

Data sources are often environment-dependent:

  • latest AMI/image
  • current account/region
  • existing network resources
  • secrets or parameters

If dev and prod are in different regions/accounts, the data source outputs can differ.

6) Conditional logic in code

Your config may include:

  • count or for_each conditions
  • if expressions
  • locals based on environment
  • module branching

For example:

count = var.environment == "prod" ? 3 : 1

This guarantees different plans.

7) Default values and unset arguments

A value omitted in one environment might be explicitly set in another. Providers may treat:

  • null
  • empty string
  • unset
  • defaulted

differently, leading to drift or plan diffs.

8) Ordering/normalization differences

Some resources have fields that providers sort or normalize:

  • security group rules
  • IAM policies
  • JSON structures
  • sets vs lists

This can create plan differences even when the logical config is “the same.”

9) Manual changes or drift

If someone changed prod manually in the cloud console/CLI, Terraform will see a different actual state and plan accordingly.

10) Different modules or code paths

If dev and prod use:

  • different branches
  • different module versions
  • different terraform.tfvars
  • different override files

then the plans will naturally diverge.


How to debug it

Compare the exact inputs

Check:

  • terraform.tfvars
  • environment variables
  • workspace
  • module versions
  • backend config
  • provider versions

Compare the state

Run:

terraform state list
terraform show

and compare dev vs prod.

Inspect the plan JSON

Generate machine-readable plans:

terraform plan -out=tfplan
terraform show -json tfplan > plan.json

Then compare the JSON outputs.

Check provider and Terraform versions

Run:

terraform version

and verify .terraform.lock.hcl.

Look for drift

Run:

terraform plan -refresh-only

This helps identify changes made outside Terraform.


Best practices to keep dev/prod predictable

  • Pin Terraform and provider versions
  • Use the same module version across environments
  • Keep environment-specific values isolated in tfvars
  • Avoid relying on unstable data sources when possible
  • Use remote state consistently
  • Prevent manual changes or regularly reconcile drift
  • Review plans in CI with the same versions used locally

If you want, I can help you debug your specific dev/prod diff if you paste:

  1. the relevant terraform plan differences,
  2. your environment variable/tfvars setup, and
  3. your provider + Terraform versions.

Brands

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.