From 5aa63d136294a42df2f65a3705655eb3c108fc2c Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Tue, 22 Oct 2024 17:04:51 +0200 Subject: [PATCH 1/2] fix: 'Need to perform AWS calls for account' when doing cross-account deployments (#31846) Fixes #31845 Manually verified that cross-account access is possible again. Will follow up with a PR for more tests. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/deployments.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/aws-cdk/lib/api/deployments.ts b/packages/aws-cdk/lib/api/deployments.ts index 788c42796be36..a2e729ce30689 100644 --- a/packages/aws-cdk/lib/api/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments.ts @@ -812,7 +812,7 @@ export class Deployments { const { manifest, stackEnv } = await this.prepareAndValidateAssets(asset, options); await publishAssets(manifest, this.sdkProvider, stackEnv, { ...options.publishOptions, - allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(stackEnv), + allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack), }); } @@ -852,15 +852,15 @@ export class Deployments { // No need to validate anymore, we already did that during build const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName); // eslint-disable-next-line no-console - await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(stackEnv) }); + await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack) }); if (publisher.hasFailures) { throw new Error(`Failed to publish asset ${asset.id}`); } } - private async allowCrossAccountAssetPublishingForEnv(env: cxapi.Environment): Promise { + private async allowCrossAccountAssetPublishingForEnv(stack: cxapi.CloudFormationStackArtifact): Promise { if (this._allowCrossAccountAssetPublishing === undefined) { - const sdk = (await this.cachedSdkForEnvironment(env, Mode.ForReading)).sdk; + const { stackSdk: sdk } = await this.prepareSdkFor(stack, undefined, Mode.ForReading); this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(sdk, this.props.toolkitStackName); } return this._allowCrossAccountAssetPublishing; From 11275fa3421f9694d622c0acbf687f0d92c98740 Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Tue, 22 Oct 2024 16:12:19 +0100 Subject: [PATCH 2/2] chore(release): 2.163.1 --- CHANGELOG.v2.alpha.md | 2 ++ CHANGELOG.v2.md | 7 +++++++ version.v2.json | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index 6475212e36ed4..ae5784f8a9df1 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.163.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.163.0-alpha.0...v2.163.1-alpha.0) (2024-10-22) + ## [2.163.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.162.1-alpha.0...v2.163.0-alpha.0) (2024-10-21) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index 72b48d4be8ef8..0bc7d0feea9bb 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.163.1](https://github.com/aws/aws-cdk/compare/v2.163.0...v2.163.1) (2024-10-22) + + +### Bug Fixes + +* 'Need to perform AWS calls for account' when doing cross-account deployments ([#31846](https://github.com/aws/aws-cdk/issues/31846)) ([5aa63d1](https://github.com/aws/aws-cdk/commit/5aa63d136294a42df2f65a3705655eb3c108fc2c)), closes [#31845](https://github.com/aws/aws-cdk/issues/31845) + ## [2.163.0](https://github.com/aws/aws-cdk/compare/v2.162.1...v2.163.0) (2024-10-21) diff --git a/version.v2.json b/version.v2.json index 142efd973f4cd..a3c8b17a2f5e2 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.163.0", - "alphaVersion": "2.163.0-alpha.0" + "version": "2.163.1", + "alphaVersion": "2.163.1-alpha.0" } \ No newline at end of file