provider/aws: aws_ami: handle deletion of AMIs #9721
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously this resource (and, by extension, the
aws_ami_copy
andaws_ami_from_instance
resources that share much of its implementation) was handling correctly the case where an AMI had been recently deregistered, and was thus still returned from the API, but not correctly dealing with the situation where the AMI has been removed altogether.Now we additionally handle the
NotFound
error returned by the API when we request a non-existent AMI, and remove the AMI from the state in the same way we do for deregistered AMIs.(I'm sorry to say that I've been sitting on this one for a while and just
-target
ing around the issues this was causing in my environment. 😞)