EC2 IMDS role is being used despite setting a non-existence profile #23261
Labels
authentication
Pertains to authentication; to the provider itself of otherwise.
bug
Addresses a defect in current functionality.
provider
Pertains to the provider itself, rather than any interaction with AWS.
Milestone
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Despite what is mentioned for the new authentication changes in version 4.0.0 and above, still we can explicitly set the
profile
to an invalid name and get the terraform provider to fall back to EC2 IMDS role on EC2 instances.This is a bug based on the documentation and it doesn't match the AWS CLI behaviour which doesn't work if
AWS_PROFILE
is set to something invalid.Expected Behavior
An explicitly set profile that does not have valid credentials will cause an authentication error.
Actual Behavior
Terraform successfully authenticates using EC2 IMDS role.
Steps to Reproduce
terraform plan
with this configuration on an EC2 instance with EC2 IMDS role available:References
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade#changes-to-authentication
The text was updated successfully, but these errors were encountered: