In reading the docs over at Terraform it says there are 3 options for finding AWS credientials:
I am trying to have my setup just use the credential file. I've checked that the environment variables are cleared and I have left the relevant variables in Terraform blank.
When I do this and run 'Terraform Plan' I get the error:
No Valid credential sources found for AWS Provider.
I've even tried adding the location of my credentials file into my provider block and that didn't help either:
provider "aws" {
region = "${var.region}"
profile = "${var.profile}"
shared_credentials_file = "/Users/david/.aws/credentials"
profile = "testing"
}
Is there something I'm missing to get Terraform to read this file and not require environment variables?
To get multiple profiles to work with Terraform make sure that you supply the
aws_access_key_id
piece to your profile declaration. Each profile should look like this:
[profile_name]
aws_access_key=*****
aws_secret_access_key****
aws_access_key_id=*****
Technically you don't even need the aws_access_key as it seems the id version is what the underlying aws cli needs. Maybe it was me, but that was never clear in the documents I read.
I tested with Terraform v0.6.15 and its working fine.
Issue must be with the profile. Check the following.
1. Remove 2 profile tags from your provider.
provider "aws" {
region = "${var.region}"
shared_credentials_file = "/Users/david/.aws/credentials"
profile = "testing"
}
2. Make sure your credentials file /Users/david/.aws/credentials is in the below format, where testing is the profile you are specifying in provider "aws"
[testing]
aws_access_key_id = *****
aws_secret_access_key = *****
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With