Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Using AWS profile with assumed role raises NoCredentialProviders #604

Closed
matthewlehner opened this issue Oct 18, 2020 · 3 comments · Fixed by #621
Closed

Using AWS profile with assumed role raises NoCredentialProviders #604

matthewlehner opened this issue Oct 18, 2020 · 3 comments · Fixed by #621
Labels
bug Something isn't working plugin/aws

Comments

@matthewlehner
Copy link

Describe the bug
I'm using an AWS profile that's an assumed cross-organization role. When running waypoint build with AWS_PROFILE set to the profile for the role, waypoint build fails when trying to push the image to the ECR repo with the following error:

! NoCredentialProviders: no valid providers in chain. Deprecated.
        For verbose messaging see aws.Config.CredentialsChainVerboseErrors

Steps to Reproduce
With a second AWS organization, set up cross organization roles following this guide: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html
Then configure the role for use with the CLI and use the AWS_PROFILE env variable to specify that URL.

For example, ~/.aws/config will contain the following:

[profile default]
region = us-east-1

[profile otherprofile]
role_arn = arn:aws:iam::123456789012:role/marketingadminrole
source_profile = default

When running AWS_PROFILE=otherprofile waypoint build, it's unable to find credentials, though running other aws commands from the CLI works.

FWIW, this setup is working with terraform.

Expected behavior
It works with the profile/credentials that are specified by AWS_PROFILE.

@jdub
Copy link

jdub commented Oct 18, 2020

Waypoint is probably using version 1 of the AWS SDK for Go – have you tried setting AWS_SDK_LOAD_CONFIG=1 in your environment? Because I use so much Go stuff with AWS, I've put it in my .bash_profile.

@mitchellh mitchellh added bug Something isn't working plugin/aws labels Oct 18, 2020
@matthewlehner
Copy link
Author

@jdub Ah, thanks, that fixes it. I hadn't heard of that setting before now.

mitchellh added a commit that referenced this issue Oct 19, 2020
Fixes #604

This enables loading ~/.aws/config for assumed role auth.

We should talk to the Terraform about making aws-sdk-go-base less
Terraform-specific so we can share it, since they've solved a lot more
problems that we're going to run into: https://github.com/hashicorp/aws-sdk-go-base

But for now, this will work.
@mitchellh
Copy link
Contributor

Good catch, I've got a PR up to fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working plugin/aws
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants