Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS_PROVIDER not working, explicit 'provider=xx' works fine #8779

Closed
glucas opened this issue May 25, 2019 · 5 comments · Fixed by #8451
Closed

AWS_PROVIDER not working, explicit 'provider=xx' works fine #8779

glucas opened this issue May 25, 2019 · 5 comments · Fixed by #8451
Labels
documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS.
Milestone

Comments

@glucas
Copy link

glucas commented May 25, 2019

Testing with terraform 0.12 and terraform-providers/aws 2.12.0, on Windows.

The following works as expected:

provider "aws" {
  profile = "test"
}

Commenting out the profile line and instead setting AWS_PROFILE to the same value in my shell does not work:

λ  $env:AWS_PROFILE='test'
λ  terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

------------------------------------------------------------------------

Error: No valid credential sources found for AWS Provider.
        Please see https://terraform.io/docs/providers/aws/index.html for more information on
        providing credentials for the AWS Provider

I can set AWS_DEFAULT_REGION in the shell and that works fine, but cannot use AWS_PROFILE.

@glucas
Copy link
Author

glucas commented May 25, 2019

Actually, this may be specific to profiles that use role_arn. Testing the same two cases above with a simple access key id configuration seems to work. But using role_arn appears to only work when I specify the profile in the AWS provider config and not using environment variables.

@bflad bflad added the provider Pertains to the provider itself, rather than any interaction with AWS. label May 28, 2019
@bflad
Copy link
Contributor

bflad commented May 28, 2019

Hi @glucas 👋 Does your Terraform environment work with the AWS_PROFILE environment variable and role_arn in the AWS configuration file if the additional environment variable AWS_SDK_LOAD_CONFIG=1 is used? e.g. AWS_SDK_LOAD_CONFIG=1 AWS_PROFILE=test terraform plan

This environment variable is not currently well documented in the Terraform AWS Provider documentation (there are a few open issues regarding this), but enabling this environment variable does enhance the behavior of AWS Go SDK based applications, like the Terraform AWS Provider.

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label May 28, 2019
@glucas
Copy link
Author

glucas commented May 28, 2019

Yes, thanks! Setting AWS_SDK_LOAD_CONFIG in my shell environment seems to work.

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label May 28, 2019
@bflad bflad added the documentation Introduces or discusses updates to documentation. label May 29, 2019
@bflad bflad added this to the v2.15.0 milestone Jun 7, 2019
@bflad
Copy link
Contributor

bflad commented Jun 7, 2019

Additional information about AWS_SDK_LOAD_CONFIG environment variable has been merged and will publish with version 2.15.0 of the Terraform AWS Provider next week.

@ghost
Copy link

ghost commented Nov 3, 2019

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!

@ghost ghost locked and limited conversation to collaborators Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants