Interview Prep/Terraform/Providers, Resources and Data Sources

Why is `aws_ami` with `most_recent = true` a risky pattern?

IntermediateConceptProviders, Resources and Data Sources
Answer

A new AMI published upstream changes the data source result, so the next plan wants to replace running instances. For production we pin an AMI ID through a variable or SSM parameter, or add ignore_changes = [ami] and roll instances through a controlled process such as an ASG instance refresh.

All Terraform questions Roadmap: Terraform

More on Providers, Resources and Data Sources