-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(cli): cross account deployments still don't work #12151
Comments
I tracked it down to: aws-cdk/packages/aws-cdk/lib/util/asset-publishing.ts Lines 46 to 48 in 4e1d951
But
It would be tricky to resolve. Possibly if placeholder replacement for |
Seeing this with CloudFormationCreateUpdateStackAction and CdkPipeline. I have a question, how the CDK Pipeline is able to deploy across accounts (example here #10166)? |
Just got back from PTO - in my testing, the CDK diff seemed to work cross account, but then yeah, got the same error as you when it tried to deploy and it failed to upload an asset. Thanks for submitting that PR, hopefully that gets us across the line and I can drop this plugin 🤞 |
cdk_asset asset handlers use IAws to make calls to AWS APIs to discover information about target environment: account id, region, partition. Each asset is described by its manifest in a Cloud Assembly. This manifest can contain placeholders to resolve by asset handlers when publishing assets. Previously `${Aws::Partition}` placeholder was derived from a code path used to resolve `${Aws::AccountId}`, which was introducing a cyclic dependency for cross account deployments: - to replace partition placeholder it was assuming role in a target account to discover partition - to assume role in a target account it needs to know full role ARN to assume - role ARN contains partition placeholder It was working for same account deployments and for non environment aware deployments, because SdkProvider was always using current default (ambient) credentials without making `AssumeRole` call, thus it was able to replace placeholders in asset manifest without introducing a cyclic dependency. To fix cross account deployments we introduce `IAWS.discoverPartition()` method to return partition of default (ambient) credentials `cdk deploy` is called with. This works, because cross partition `AssumeRole` calls are not possible, therefore it's enough to know our default credentials partition. Fixes #12151 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Reproduction Steps
CI account: 0147xxxxxxxx
Target account: 1454xxxxxxx
Target account is bootstrapped to trust CI account with
--trust 0147xxxxxxxx
. IAM user in CI account graned permissioniam:AssumeRole
to all roles created by bootstrap stack.Create CDK app with environment in target account and an S3 asset:
Do
cdk deploy
from CI account.What did you expect to happen?
Successfull deploy
What actually happened?
If we try to deploy it with
cdk deploy -v
following happens:Environment
Other
Interestingly,
cdk-assets
uploads just fine. Exact commands when run from CI:Produce following output (tail):
Looks like fix done in #11966 is incomplete.
/cc @rix0rrr , @scarytom , @polothy
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: