New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded
on v4.0.0
#23209
Comments
Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded
on v4.0.0
Hi @speller, this has been fixed in v4.1.0, which will be released later today. |
Even using this new version, I still have this error when trying to use the AWS provider.
And I can also see that I'm using the latest version of it: Initializing provider plugins...
- Finding latest version of hashicorp/aws...
- Installing hashicorp/aws v4.1.0...
- Installed hashicorp/aws v4.1.0 (signed by HashiCorp) Edit: |
Yes i am also facing the same error as above. Is there a workaround |
Only workaround that I found was to lock version to v3.74.0 you can do it simply by: terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.74.0"
}
}
} |
thank you @thebergamo . It worked |
I see this is closed but I am not sure if it makes sense. For example, I am running some terraform jobs in my CircleCI pipeline and I so far had no issues whatsoever with this, now it seems I need to choose what to use. I am thinking of a few things:
Maybe I am missing something so if someone has any suggestion, please let me know. |
where is this file normally located to lock down the version to 3.74? Or what's the file normally called |
@hectoralicea it would depend mostly on how you organize your code. Take a look into this docs |
I think I was able to get past this by adding the text snippet below to the top of the file:
|
@hectoralicea
|
I'm seeing this error message, even with the last I set up my local environment from scratch, and made sure my provider config was empty, and configured my aws connection with the aws cli tool (which created with v4.3.0 I get this:
But with v3.74.3 (with only
I tried adding all sorts of permissions to my aws user that I'm using the token and id for, but Is this still an active bug? or did I miss some kind of permissions somewhere? UPDATE - I gave the user admin access, and still got the same error, so it doesn't seem like a permissions thing. |
I've found that it works if I add the key and id to the provider config, but doesn't work if I use environment variables, or the credentials file, which are supposed to be the next two things in line to check. |
I have the same problem, not with terraform, but with my Go program, that uses aws-sdk-v2. Environment variables seems to be not handled properly. |
See the documentation below. There is a good write up about what needs to be changed to resolve this issue. |
@peterkools I don't see any mention of this error anywhere in that document. And as I mentioned, it only works if I use the provider config, where if there's no provider config, it's supposed to get the credentials from environment variables (as per the precedence order), but it doesn't. I know because I set the environment variables and copied the names straight from the documentation, and also ran the aws cli command to log in and it created the ~/.aws/config like it should've. And neither of those worked. As @chubin said, It seems like it's only looking in the provider config, and then skipping the environment variables, and going ahead with the connection attempt even if it has nothing. |
I am hitting this too with the latest version of the AWS provider. I have in my versions.tf:
And then in my main.tf:
I have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY defined as variables in Terraform Cloud, and I know they work as they have full admin rights and are used in other Terraform Cloud projects. Strangely, this exact same configuration works on a previous TF Cloud workspace. I get the error:
|
fixed, I had "AWS_ACCESS_KEY_ID" spelled with three "S"'s |
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. |
On AWS provider version 4.0.0 I'm getting the following error:
Version 3.72.0 works perfectly. I'm using the following provider configuration:
The text was updated successfully, but these errors were encountered: