Interview Prep/Terraform/Lifecycle, Dependencies, Provisioners and Drift

When do you use `ignore_changes`?

IntermediateConceptLifecycle, Dependencies, Provisioners and Drift
Answer

When something else legitimately modifies an attribute, such as autoscaling changing desired_capacity, or an external system adding tags. List attributes explicitly.

lifecycle {
  ignore_changes = [desired_capacity, tags["last_deployed"]]
}

ignore_changes = all freezes everything after creation and hides real drift, so we avoid it.

All Terraform questions Roadmap: Terraform in production

More on Lifecycle, Dependencies, Provisioners and Drift