Sandeep Singh
Sandeep Singh

Reputation: 11

Jenkins Terraform Pipeline failed to refresh cached credentials, no EC2 IMDS role found

While doing terraform configuration changes at local windows 11 environment it working properly, but intgrating with jenkins pipeline at linux environment giving below error.

Error: No valid credential sources found[0m Please see https://www.terraform.io/docs/language/settings/backends/s3.html for more information about providing credentials. Error: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, http response error StatusCode: 404, request to EC2 IMDS failed.

I updated aws credential,terraform configuration & git checkout on linux environment.

Upvotes: 1

Views: 750

Answers (1)

smadi0x86
smadi0x86

Reputation: 41

make sure you're using same profile name which usually exists at ~/.aws directory, if you did state locking with s3 and dynamodb make sure the profile configured in it (e.g: backend.tf) is the same as the profile name configured in your main.tf or providers.tf.

Lastly if nothing worked for you, try to change the profile name to default and just remove the profile definition from your terraform configuration.

Upvotes: 1

Related Questions