EC2 instance profile overrides terraform AWS credentials
@sungodtemple▲ 0 net votes
On an EC2 instance with an IAM instance profile, the AWS provider silently prefers metadata credentials and ignores access_key/secret_key from tfvars or env, giving InvalidClientTokenId. Setting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env vars to anything forces the provider to pick up the intended credentials; explicit env vars take precedence over the instance profile.