Skip to content
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

app-staging-synthesizer-alpha: Uses default bootstrap exec role when bootstrapQualifier is supplied #28195

Open
BrianFarnhill opened this issue Nov 29, 2023 · 2 comments
Labels
@aws-cdk/app-staging-synthesizer-alpha Related to the @aws-cdk/app-staging-synthesizer-alpha package bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@BrianFarnhill
Copy link

Describe the bug

Consider the following use of the AppStagingSynthesizer:

defaultStackSynthesizer: AppStagingSynthesizer.defaultResources({
    appId: 'UniqueAppId',
    bootstrapQualifier: 'Custom',
    deploymentIdentities: DeploymentIdentities.defaultBootstrapRoles({
      bootstrapRegion: 'ap-southeast-2',
    }),
  }),

In this scenario I'm trying to avoid the use of the default qualifier at all (to meet a customer requirement, each bootstrap uses a unique qualifier that enforces a specific permission boundary for each app that is deployed). When I deploy this the app works and my main CDK stacks all use the CFN exec role that goes with the 'Custom' qualifier in this case, but the Staging Stack itself still relies on the exec role from the default bootstrap. I would expect that given I've specified a qualifier here that it would use that for the staging stack as well, but if that assumption is wrong, having an option to specific the exec role for the staging stack would also address the concern.

Expected Behavior

I would expect the deployment role used on the staging stack to match that of the Custom bootstrap qualifier that was deployed in to the account.

Current Behavior

It deploys with the default bootstrap qualifier instead (being hnb659fds and the role arn:aws:iam::{ACCOUNT}:role/cdk-hnb659fds-cfn-exec-role-{ACCOUNT}-{REGION} if you don't customise the bootstrap)

Reproduction Steps

Use the code snippet from the example - you'll need to create a secondary bootstrap qualifier as well as the default one though, so the flow would be:

  1. Deploy the default bootstrap with cdk bootstrap aws://ACCOUNT-NUMBER-1/REGION-1 (using your account number and region)
  2. Deploy a custom bootstrap with cdk bootstrap --qualifier Custom aws://ACCOUNT-NUMBER-1/REGION-1 (using your account number and region)
  3. Use the snippet above with the qualifier name and appropriate region name
  4. Deploy any CDK stack against that synthesiser

Go in here and look at the deployed stack, you'll see the StagingStack uses the default qualifier. You'll also see that role called out in the manifest.json file in the cdk.out directory for the staging stack:

"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.100.0 (build e1b5c77)

Framework Version

No response

Node.js Version

v18.18.0

OS

Linux and MacOs

Language

TypeScript

Language Version

TypeScript (5.5.2)

Other information

No response

@BrianFarnhill BrianFarnhill added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 29, 2023
@github-actions github-actions bot added the @aws-cdk/app-staging-synthesizer-alpha Related to the @aws-cdk/app-staging-synthesizer-alpha package label Nov 29, 2023
@pahud pahud self-assigned this Nov 30, 2023
@pahud pahud changed the title @aws-cdk/app-staging-synthesizer-alpha: Uses default bootstrap exec role when bootstrapQualifier is supplied app-staging-synthesizer-alpha: Uses default bootstrap exec role when bootstrapQualifier is supplied Nov 30, 2023
@pahud
Copy link
Contributor

pahud commented Nov 30, 2023

Yes I can reproduce this, it's still deploying with the role using hnb659fds qualifier.

@pahud pahud added p1 effort/medium Medium work item – several days of effort needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Nov 30, 2023
@pahud pahud removed their assignment Nov 30, 2023
@pahud pahud removed the needs-review label Dec 6, 2023
@pahud pahud added p2 and removed p1 labels Jun 11, 2024
@sakurai-ryo
Copy link
Contributor

We are using BootstraplessSynthesizer to deploy the StagingStack, but we can't pass qualifier to it like we can to DefaultStackSynthesizer .
So need to update the BootstraplessSynthesizerProps to accept arguments such as qualifier.

I'll submit a PR when I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/app-staging-synthesizer-alpha Related to the @aws-cdk/app-staging-synthesizer-alpha package bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

3 participants