-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
❗NOTICE: Cross-account deployments are failing in v2.163.0 with error 'Need to perform AWS calls for account' #31845
Comments
We are facing the same issue after upgrading to release v2.163.0, we are encountering errors during deployments involving cross-account role assumptions:
Downgrading to v2.162.0 resolves the issue for now. |
Apologies in advance that I have not tested this as thoroughly as I normally would before raising an issue, but my ability to spin up completely fresh AWS accounts is limited in the org environment. If the reproduction steps as I've written them do work (i.e. dont reproduce the issue) I have the following additional variables that I've observed in our environment:
I will attempt to do further testing if I can get some clean accounts approved, but I'm hoping that you guys have better options in the "clean test accounts" field than I do. |
Having same problem here. |
Same issue here. Downgrading to |
After further investigation, I can confirm this was caused by #31623, specifically this line: const sdk = (await this.cachedSdkForEnvironment(env, Mode.ForReading)).sdk; All other uses of const stackSdk = await this.cachedSdkForEnvironment(resolvedEnvironment, Mode.ForReading, {
assumeRoleArn: arns.lookupRoleArn,
assumeRoleExternalId: stack.lookupRole?.assumeRoleExternalId,
assumeRoleAdditionalOptions: stack.lookupRole?.assumeRoleAdditionalOptions,
}); In a cross-account deployment |
We're having the same issue. Can confirm downgrading to cdk@2.162.1 works as suggested by @kevin-journey (Thanks!). |
Comments on closed issues and PRs are hard for our team to see. |
Comments on closed issues and PRs are hard for our team to see. |
Release with fix is in progress. |
v2.163.1 was released with a fix. Can you please confirm if this resolves the issue for you? |
Same issue here that started with 2.163.0, except downgrading did not resolve anything (I tried going back to several different versions) - even after re-bootstrapoping both accounts. It broke deploys from githubactions as well as codepipeline. I've had a ticket open with AWS support for 4 days with absolutely no progress. The weirest part is that if I open up permissions on the deployment account, it will deploy the metadata to the correct target account, while all of the application assets get created in the deployment/pipeline account. Fortunately, we can still deploy from local machines using a profile for the target account to bypass the assumerole step, otherwise this would be a very big problem. |
Hi @scottrmercer sorry you are having issues. Can you please provides some more details on the error you're hitting and the setup you're using? A full dump of the error output will do. What version did you upgrade from? What's the last known working version for you? While I'm sure you are experiencing issues, this particular change was only introduced in v2.163.0. If reverting back to older versions does not resolve this for you, we are probably looking at a (slighty) different situation. Unfortunately the possible causes for this error message are quite varied and many of them are intentional. |
Of course! Thanks for the reply. Here is an abbreviated version of the log:
My CDK project is very vanilla:
|
Thanks @scottrmercer that's very helpful. One more thing: What version of the bootstrap template are you on? Could you manually check this please. Are you using custom bootstrapping at all? |
I can't reproduce this on my machine. I'm seeing some irregularity in the code of your app (or at least, it doesn't look like this is what you intended): export class ExampleWebServiceApiStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: ExampleWebServiceStackProps) {
super(scope, id);
// ^^^^^^ missing passing 'props' to super() Even having said that, that shouldn't cause a failure, just deploy to the wrong environment. EDIT: it will cause a failure if it's not possible to deploy to environment AAAAAAAAAA at all because it hasn't been bootstrapped; assuming the AAAA-deploy-role will fail, but it will proceed anyway with the current credentials because they are for the right account, and then fail because presumably your GitHub role doesn't have a lot of permissions. |
I can confirm that 2.163.1 resolved the issue for us, thanks for the quick turnaround. |
Please add your +1 👍 to let us know you have encountered this
Status: RESOLVED
Overview:
Release v2.163.0 introduced an issues with cross-account deployments. The AWS CDK fails with the error
Need to perform AWS calls for account XXXXX, but the current credentials are for YYYYY
. The root cause is a new check for the bootstrap version added in v2.163.0. The check needs to make an API call to AWS CloudFormation to describe the bootstrap stack. This API call was using incorrect credentials.Complete Error Message:
Need to perform AWS calls for account XXXXXXXXXXXX, but the current credentials are for YYYYYYYYYYYY
Workaround:
Downgrade the AWS CDK CLI to version 2.162.1
Solution:
Upgrade the AWS CDK CLI to version 2.163.1
Related Issues:
n/a
Original issue:
Describe the bug
Release v2.163.0 causes deployments using cross account role assumption to fail with the error
Need to perform *** calls for account XXXXX, but the current credentials are for YYYYY
. This is presumably caused by #31623.Based on comments on this PR (as it has no description or linked issue) this was done to address a vulnerability when the assets bucket for an account is not longer in the target account, but this failure is occurring when the assets bucket is still in the target account with no change.
These deployments and buckets are in the ap-southeast-2 region.
Regression Issue
Confirmed Regression
Last Known Working CDK Version
2.162.1
Expected Behavior
Cross account deployments should succeed unless the asset bucket is no longer in the target account.
Current Behavior
Cross account deployments fail with the error
Need to perform *** calls for account XXXXX, but the current credentials are for YYYYY
cdk diff
succeeds as expected, and cloudtrail shows role assumption is successful.Debug log excerpt just before the failure:
Reproduction Steps
npx cdk deploy
on a stack with account B as the env.account property. May need to also set region to ap-southeast-2, I have not been able to test this in us-east-1 yet.Possible Solution
Roll back #31623 until full integration testing can be performed.
Additional Information/Context
This change has caused all deployments from our CICD to fail, as they make use of cross account role assumption and use the latest CDK V2 CLI unless otherwise specified (due to caret version matching to avoid breaking changes). I would like to request that this change be rolled back until it can be thoroughly integration tested. If this is not possible, the new expected requirements for cross account CDK deployments need to be clearly documented.
CDK CLI Version
2.163.0
Framework Version
No response
Node.js Version
v20.13.1
OS
Debian Linux
Language
TypeScript
Language Version
TypeScript (5.6.3)
Other information
No response
The text was updated successfully, but these errors were encountered: