-
Notifications
You must be signed in to change notification settings - Fork 16
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
pulumi up fails with "error: could not get AWS account ID: operation error STS: GetCallerIdentity" even though there are valid credential #1923
Comments
Cannot seem to reproduce this easily unfortunately, I use I've checked the Go SDK verisons but it seems both pulumi/pulumi-aws-native and pulumi/pulumi-aws use the same version of Go SDK v2. |
If I use If I clear the credential environment variables using Looking at the cache data in ~/.aws/sso/cache, I notice that there is a difference in the cached data. The JSON object for the So the cached SSO credential data and what is in the environment variables is sufficient for classic provider, but not the cloud control provider, so there is some difference. |
Hey @eriklz, I'm not familiar with granted, but the error message The explicitly defined credentials take precedence over the profile configuration ( The problem lies here: pulumi-aws-native/provider/pkg/provider/provider.go Lines 303 to 306 in 09d081f
If a profile is set, we're replacing the default credential chain by one hard coded to use the profile. I'll need to do some thinking around the implications of changing this (i.e. breaking changes). @eriklz for now you could work around that by un-setting |
After thinking a bit about it, I do not think we can correct this in a minor version and need to wait for the next major version. There's most definitely some users that depend on this behavior and making the change now would break their workflows. For now we should emit a warning if both explicit creds and a profile are specified and hint at the behavior being changed in the next major version. Additionally we can introduce a provider configuration option (e.g. |
I am fine with the workaround, the AWS profile environment variable set by granted also, and is set to the same profile as the temporary credentials are set for. Knowing why it happens and what to do about it is good enough for now, I think. |
What happened?
I created a project with
pulumi new aws-typescript
, pnpm package manager.After that I changed it to use the AWS Cloud Control provider.
Credentials activated via
assume -x awsprofilename
(tool https://granted.dev), an AWS SSO profile.Running
pulumi up
failed:Running the original project with the "classic" AWS provider works fine in the same shell session and with the same credentials activated as used above.
Example
index.ts:
package.json:
Environment variables starting with AWS that are set:
AWS_SESSION_TOKEN
AWS_DEFAULT_REGION
AWS_SESSION_EXPIRATION
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_CREDENTIAL_EXPIRATION
AWS_REGION
AWS_PROFILE
Output of
pulumi about
❯ pulumi about
CLI
Version 3.143.0
Go Version go1.23.4
Go Compiler gc
Plugins
KIND NAME VERSION
resource aws 6.65.0
resource aws-native 1.17.0
resource awsx 2.19.0
resource docker 4.5.8
resource docker 3.6.1
language nodejs 3.143.0-dev.0
Host
OS darwin
Version 14.6.1
Arch arm64
This project is written in nodejs: executable='/Users/eriklz/.local/state/fnm_multishells/6144_1734648945463/bin/node' version='v22.11.0'
Current Stack: elz/cred-validate/dev
Found no resources associated with dev
Found no pending operations associated with dev
Backend
Name pulumi.com
URL https://app.pulumi.com/elz
User elz
Organizations elz
Token type personal
Pulumi locates its logs in /var/folders/ms/t731ppx52m56f1qgfhmt0tmm0000gn/T/ by default
warning: Failed to get information about the Pulumi program's dependencies: no package-lock.json or yarn.lock file found (searching upwards from /Users/eriklz/Documents/Dev/elz_repos/pulumi-cdk-tests/cred-validate)
Additional context
I first discovered this issue when trying pulumi-cdk, and then tested this above to see if the issue was with pulumi-cdk, or with the AWS Cloud Control provider. It seems to be with the AWS Cloud Control provider, hopefully addressing this will also resolve this issue for pulumi-cdk.
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: