Open paololazzari opened 2 years ago
Apparently this was caused by an attempt to launch an instance from an AMI that was no longer available.
Can the error message be improved?
Just wasted 30' on an obscure error message, this still hasn't been improved.
It is really impressive how this error message is useless. This happens if the AMI was deleted or made private; if your account has no longer access to the ami, this error is show.
I think this could happen when TF expects images "Owned by Me", but the user does not have such images.
In my case I have only "Private snapshots/Private images" which were shared with me.
If I enable TF_LOG=debug terraform apply
, I can see that TF receives empty response:
2024-04-11T14:39:10.813-0400 [DEBUG] provider.terraform-provider-aws_v5.44.0_x5: HTTP Response Received: http.response.header.content_type=text/xml;charset=UTF-8 rpc.service=EC2 tf_aws.sdk=aws-sdk-go http.duration=440 tf_mux_provider="*schema.GRPCProviderServer" @module=aws http.status_code=200
http.response.body=
| <?xml version="1.0" encoding="UTF-8"?>
| <DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
| <requestId>34f5c8d2-5736-4dc2-8137-b76494adf399</requestId>
| <imagesSet/>
| </DescribeImagesResponse>
http.response.header.cache_control="no-cache, no-store" http.response.header.date="Thu, 11 Apr 2024 18:39:10 GMT" http.response.header.server=AmazonEC2 rpc.system=aws-api tf_rpc=ApplyResourceChange aws.region=us-east-1 tf_resource_type=aws_instance http.response.header.x_amzn_requestid=34f5c8d2-5736-4dc2-8137-b76494adf399 http.response_content_length=219 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=53bb7eea-ce90-26fc-6730-86cbabbb6d9c @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.52/logger.go:157 http.response.header.strict_transport_security="max-age=31536000; includeSubDomains" rpc.method=DescribeImages timestamp=2024-04-11T14:39:10.812-0400
I had deployed an EC2 instance with terraform. I then removed the EC2 instance from terraform with:
now, when I try to re-create the instance I see an error:
Note that terraform plan works as expected and shows the instance to be created:
Terraform Version
v.1.2.4