๐Ÿ“

Terraform drift / unexpected plan changes

Plan wants to recreate resources or state differs from reality.

Reviewed: ยทTested on: Kubernetes 1.29, Terraform 1.8, Ubuntu 22.04

Symptoms

  • forces replacement
  • drift detected
  • resource changed outside terraform

1Compare state vs plan

terraform plan -detailed-exitcode
terraform state list
terraform state show <resource>

2Refresh or import

terraform refresh
# Import manual change:
terraform import <resource_type>.<name> <id>
# Or align code to reality before apply

Related