According to the docs for aws provider here (https://www.terraform.io/docs/providers/aws/#region), "region" is a required field which can be set "via a shared credentials file if profile is specified"
I read this to mean that if I configure my provider something like this
provider "aws" {
profile = "stage"
}
and ~/.aws/config contains something like the following
[profile stage]
output = json
region = us-gov-west-1
the "region" argument should be set to "us-gov-west-1".
However, when I use this configuration and run terraform plan I get the following:
provider.aws.region
The region where AWS operations will take place. Examples
are us-east-1, us-west-2, etc.
Default: us-east-1
Enter a value:
Am I misunderstanding the documentation?
Terraform v0.10.6
I think you have the wrong format in your ~/.aws/config . Noprofile should appear when you specify your profile name. Please check examples found online
The ~/.aws/config file was generated via the cli by using aws configure --profile stage. I should point out that there are two files in the ~/.aws/ directory. There's both a config and credentials. The aws key and secret are in the credentials file, but the region is in config.
Currently, as far as I understand, ~/.aws/config is not parsed at all. Some steps have been made to support it here https://github.com/terraform-providers/terraform-provider-aws/pull/1608
However, it looks like the current code always overrides region anyway.
I had the same issue today while configuring terraform aws provider to use a profile... the region is set in the profile but not respected by terraform.
+1 for this issue
Terraform v0.11.3
+ provider.aws v1.9.0
+1
Terraform v0.11.5
+ provider.aws v1.13.0
+1
Terraform v0.11.7
`+ provider.aws v1.29.0
yeah, this is effecting me as well.
apparently need to specify via AWS_DEFAULT_REGION or in tf backend/provider stanza's...
would be great to be able to specify in ~/.aws tho...
Any updates on this, or a targeted/expected version this may be fixed in?
Still an issue with
Terraform v0.11.11
`+ provider.aws v1.56.0
Hi folks 👋 This appears to be a duplicate of #687, so to consolidate discussions and efforts, I'm going to close this issue in preference of that one. Please 👍 upvote that issue and subscribe to it for further updates on this topic.
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!
Most helpful comment
Currently, as far as I understand,
~/.aws/configis not parsed at all. Some steps have been made to support it here https://github.com/terraform-providers/terraform-provider-aws/pull/1608However, it looks like the current code always overrides region anyway.