Terraform v0.11.14
provider "aws" {
region = "us-east-1"
}
resource "aws_launch_configuration" "launch_configuration" {
name_prefix = "test-launch-configuration"
image_id = "ami-XXXXX"
instance_type = "t3.small"
root_block_device = {
volume_type = "standard"
}
}
The AMI should be changed regardless of the fact that the old AMI has been deregistered.
An error is thrown by Terraform that the old AMI is not found:
$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
aws_launch_configuration.launch_configuration: Refreshing state... (ID: test-launch-configuration20190920144712144900000001)
Error: Error refreshing state: 1 error occurred:
* aws_launch_configuration.launch_configuration: 1 error occurred:
* aws_launch_configuration.launch_configuration: aws_launch_configuration.launch_configuration: No images found for AMI ami-XXXXX
terraform apply with any version of provider.awsterraform apply with a version of provider.aws >= 2.23It seems that this bug has been introduced in version 2.23 as mentioned in the references.
It actually appears that the initial apply of the code can be done with any version of the AWS provider, so I have reflected this in the steps to reproduce.
I'm also seeing this issue. Resolved by doing AMI changes manually and then importing resources back into Terraform state.
no error when version
provider "aws" {
version = "<=2.22"
๐
A temporary workaround (other than @ernetas's)... if you're able, manually delete the resource then plan/apply. That worked for me. TF seems to deal with not finding the resource at all and then just puts it back but with the updated details.
Hi folks ๐ We recently merged #9810 and with further testing from the original issue report here, it appears additional changes are needed to handle this condition. Hopefully will be able to submit a fix this week.
The fix for this has been merged and will release with version 2.49.0 of the Terraform AWS Provider, tomorrow. ๐
This has been released in version 2.49.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
no error when version
provider "aws" {
version = "<=2.22"