When using an AWS EC2 instance profile for Terraform Enterprise, Cost Estimation reports “X out of X resources could not be estimated”.
The AWS SDKs use IMDSv2 (instance metadata) calls by default. If the IMDSv2 call receives no response, the SDK retries the call and, if still unsuccessful, uses IMDSv1. This can result in a delay. In a container environment, if the hop limit is 1, the IMDSv2 response does not return because going to the container is considered an additional network hop.
To avoid the process of falling back to IMDSv1 and the resultant delay, in a container environment we recommend that you set the hop limit to 2.
Update the instance metadata immediately using the following command where
i-XXXXXXXXXXXXis the EC2 instance ID.
$ aws ec2 modify-instance-metadata-options \ --instance-id i-XXXXXXXXXXXX \ --http-put-response-hop-limit 2 \ --http-endpoint enabled
Launch a new instance with the updated metadata options. Make sure
http_put_response_hop_limitis at least 2.
For more information on IMDSv2, see Configure the instance metadata options.