pulumi-aws: Error running pulumi-aws in CI environment when assuming a role for credentials
The code would effectively be doing the following:
const provider = new aws.Provider("provider-name", {
skipCredentialsValidation: false,
skipMetadataApiCheck: false,
region: <region name>,
profile: <empty string>,
})
This is working in 3.23.0 but not in 3.29.1 and would be using an IAM Role to get the credentials. The error message is:
error: 1 error occurred:
* error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.
Please see https://registry.terraform.io/providers/hashicorp/aws
for more information about providing credentials.
Error: NoCredentialProviders: no valid providers in chain. Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrors
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 27 (8 by maintainers)
Hi all
Based on the investigation work by @DavidHe1127 and @leezen, I was able to find that there was indeed a bug in named providers that stopped values being used that were not the default
I was able to fix that in https://github.com/pulumi/pulumi/pull/6496
This work has made it’s way down to the pulumi-aws provider as v3.32.1 and we believe this now means that you can set your values as expected and you should be able to authenticate in an EC2 environment with the iam role.
Your code would need to be something like this:
and it will pick up the creds
I am going to close this issue out BUT IF THERE ARE ANY FURTHER ANOMOLIES then please do comment and we can reopen and investigate further if needed
Thanks again for your patience here and we can’t thank you enough for helping us track down this bug
Paul
Hi @dferretti
If these config values work for you, then I will also add a guide to the README to suggest
### Running Pulumi-Aws in CI environments
so that others don’t get bittenP.
That is a bug! Great catch @hbollon - I will open an issue!
Hi @stack72 Little follow-up for our problem with @yann-soubeyrand With
pulumi.Bool
values we can’t setSkip*
attributes of theaws.ProviderArgs
struct because they are overridden by default values according to the pulumi preview output. For exemple with:We have this:
However, if we use
pulumi.BoolPtr
instead we have the expected result:My guess, after having taken a look at the code, is that you have some condition in the
aws.NewProvider
function which call IsZero utility func on those args (skip* and region) in order to set default values if none was provided:And in this
IsZero
function you’re performing a test on the default value of the type of the argument:Knowing that, with a bool variable set to false as input it seems normal that this function return true and so override the arg (SkipMetadataApiCheck in our case) back to true. Is it an intended feature? In your exemples you also used
pulumi.Bool
and not the Ptr equivalent 🤔We are seeing a slight variation of the error:
With the
I’m curious why this breaking change was made in a patch release