When doing a terraform plan, i expect terraform to read my aws credentials file located in /Users/myuser/.aws/credential. But instead I get the below as the response
Terraform Version: *v0.10.2*
Debug Output
Error running plan: 1 error(s) occurred:
Expected Behaviour
I expect Terraform to read the credentials file and use them to authenticate with AWS
Actual Behavior
Terraform fails to run plan because it can't find the proper credentials.
Steps to Reproduce
Use the following test case
provider "aws" {
region = "us-east-1"
shared_credentials_file = "/Users/karthikbalasubramanian/.aws/credentials"
profile = "testing"
}
resource "aws_instance" "example" {
ami = "ami-2757f631"
instance_type = "t2.micro"
}
And here is my credential file
[testing]
aws_access_key = ********
aws_secret_access_key = *******
aws_access_key_id instead of aws_access_key in your credential file?
If that doesn't work, you could run with TF_LOG=DEBUG and paste the output here for easy troubleshooting
Thanks for the info, that change seemed to have worked. can someone update the document here https://www.terraform.io/intro/getting-started/build.html, it still says
Replace the ACCESS_KEY_HERE and SECRET_KEY_HERE with your AWS access key and secret key, available from this page. We're hardcoding them for now, but will extract these into variables later in the getting started guide.
Thanks
K
I don't see any issue with the doc which refers to access_key and secret_key attributes in provider block.
Whereas you use shared_credentials_file attribute and the format of the credential file has to follow AWS guide.
@trung is right - the format needs to follow the mentioned guide, i.e.
aws_access_key_id = ACCESS_KEY
aws_secret_access_key = SECRET_KEY
I'm going to close this issue as Terraform works as intended here.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!