Reputation: 11
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.
terraform local/windows environment
: Terraform v1.7.3 on windows_amd64
terraform linux environment
: Terraform v1.6.5 on linux_386
terraform provider
: provider registry.terraform.io/hashicorp/aws v5.40.0
Terraform code repo: https://github.com/clouddevaws1961/Terraform
Upvotes: 1
Views: 750
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