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.
More on Providers, Resources and Data Sources
What is a resource block and how is it addressed?BeginnerWhat is the difference between a resource and a data source?BeginnerHow do you configure a provider such as AWS?BeginnerHow do you use the same provider with multiple regions or accounts?IntermediateIn what order does the AWS provider look for credentials?IntermediateWhat does `default_tags` in the AWS provider do and what are its pitfalls?Intermediate