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

What does `replace_triggered_by` do?

AdvancedConceptLifecycle, Dependencies, Provisioners and Drift
Answer

It forces replacement of a resource when another resource or attribute changes, even if the resource itself shows no diff.

lifecycle {
  replace_triggered_by = [aws_launch_template.app.latest_version]
}

Useful when a dependency changes in a way the dependent does not notice (for instance a config object feeding a running instance).

All Terraform questions Roadmap: Terraform in production

More on Lifecycle, Dependencies, Provisioners and Drift