Skip to main content
Fix Terraform Error - Inconsistent Plan After Apply

Fix Terraform Error - Inconsistent Plan After Apply

Key Takeaway

How to fix 'Provider produced inconsistent result after apply' errors. Understanding eventual consistency and post-apply drift.

Table of Contents

The Error

Provider produced inconsistent result after apply

What Causes This

After applying, Terraform reads the resource back and finds it doesn’t match what was expected. This is usually a provider bug or an eventual consistency issue where the cloud API hasn’t propagated changes yet.

How to Fix It

Solution 1: Re-run Apply

# Often the simplest fix — eventual consistency resolves itself
terraform apply
# The second run usually succeeds

Solution 2: Use Lifecycle Ignore

resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t3.micro"

  lifecycle {
    ignore_changes = [
      tags["LastModified"],  # Ignore auto-set tags
      user_data,             # Ignore computed changes
    ]
  }
}

Solution 3: Refresh State

terraform refresh
terraform plan
# Check if the plan shows expected changes

Solution 4: Update Provider Version

# This is often a provider bug fixed in newer versions
terraform init -upgrade
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"  # Use latest 5.x
    }
  }
}

Prevention Tips

  1. Pin provider versions — avoid surprise breaking changes
  2. Use CI/CD — catch errors before they hit production
  3. Test with terraform plan — always review before applying
  4. Keep Terraform updated — newer versions have better error messages
  5. Use terraform validate — catches syntax errors early

Hands-On Courses

Learn to avoid these errors with interactive, project-based courses:

Conclusion

This error is common and fixable. Follow the solutions above, and check our Terraform course for hands-on training that covers real-world troubleshooting scenarios.

🚀

Level Up Your Terraform Skills

Hands-on courses, books, and resources from Luca Berton

Luca Berton
Written by

Luca Berton

DevOps Engineer, AWS Partner, Terraform expert, and author. Creator of Ansible Pilot, Terraform Pilot, and CopyPasteLearn.