terraform-provider-aws: `Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded` on v4.0.0
On AWS provider version 4.0.0 I’m getting the following error:
Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.
│
│ Please see https://registry.terraform.io/providers/hashicorp/aws
│ for more information about providing credentials.
│
│ Error: no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded
│
│
│ with provider["registry.terraform.io/hashicorp/aws"],
│ on main.tf line 1, in provider "aws":
│ 1: provider "aws" {
Version 3.72.0 works perfectly. I’m using the following provider configuration:
provider "aws" {
region = var.aws_region
assume_role {
duration_seconds = 3600
session_name = "session-name"
role_arn = var.aws_deployment_role
}
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (1 by maintainers)
Commits related to this issue
- fix aws provider version to resolve https://github.com/hashicorp/terraform-provider-aws/issues/23209 — committed to flatstack-warsaw-dashboard/PTOs-widget by kamilhism 2 years ago
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. Normally, I use the
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYin my CD and profile for local work.I am thinking of a few things:
~/.aws/credentialsfile within the pipeline, with the profile set in it so that it does not fail,~/.aws/credentialsfile contains around 15 different profiles.Maybe I am missing something so if someone has any suggestion, please let me know.
@hectoralicea If you want to use
4.xversion instead of3.0you have to be sure you configureawseither using environment variables or in the.tffile, if you mix both approaches, this version will take just one. More info hereI 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.
fixed, I had “AWS_ACCESS_KEY_ID” spelled with three “S”'s
thank you @thebergamo . It worked
Hi @speller, this has been fixed in v4.1.0, which will be released later today.