https://pulumi.com logo
Title
s

sparse-apartment-71989

02/08/2022, 4:09 PM
In the docs at https://www.pulumi.com/registry/packages/aws/installation-configuration/ it says if multiple profiles are configured,
In this case, you will need to set the AWS_PROFILE environment variable to the name of the profile to use.
However, later in the docs, an alternative method is offered:
After creating your project, run pulumi config set aws:profile <profilename>
If these differ, which takes precedence, the env var or the config setting? In general will this order of precedence always be true for configuration in Pulumi?
l

little-cartoon-10569

02/08/2022, 8:05 PM
I don't speak golang, so I'm not sure I'm reading this right (https://github.com/pulumi/pulumi-aws/blob/71fc8016fd7e2f169481fd199036fc10f4d4743f/provider/resources.go), but I think the config setting takes precedence over the env var.
Two things to note though: if you're using the S3 backend, it doesn't use the provider, so aws:profile is ignored. Only the env var affects the backend.
And, this code is used only if you don't provide the
profile
property when creating your AWS provider resource (or if you're using the default provider). It's easy to provide your own value when creating your own provider.
s

sparse-apartment-71989

02/08/2022, 8:19 PM
Thanks for all that @little-cartoon-10569.
👍 1