-
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
fix(servicecatalogappregistry): Allow user to control stack id via stack name for Application stack #24171
Conversation
…ine custom stack id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the extremely detailed PR description! That will be helpful to users
const stackId = this.applicationOptions.stackId ?? 'ApplicationAssociatorStack'; | ||
(this.applicationOptions.stackName as string) = | ||
this.applicationOptions.stackName || `Application-${this.applicationOptions.applicationName}-Stack`; | ||
const stackId = this.applicationOptions.stackId ?? `Application-${this.applicationOptions.applicationName}-Stack`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stackId
existed so you could change the name of the deployed stack, but that was the wrong mechanism, so we deprecated it in favor of the stackName
. Now when you run cdk list
or cdk deploy
and you have to choose a stack id, you see a stack id that you didn't specify.
We don't need to re-introduce the stackId
property to solve this; instead, we could set:
const stackId = this.applicationOptions.stackId ?? `Application-${this.applicationOptions.applicationName}-Stack`; | |
(this.applicationOptions.stackName as string) = | |
this.applicationOptions.stackName || `Application-${this.applicationOptions.applicationName}-Stack`; | |
const stackId = this.applicationOptions.stackName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, and it was an option the issue reporter was OK with. I pushed a new commit with your proposed change to assign stack id the value of stack name. Also updated the PR description to reflect this.
Pull request has been modified.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…ter deployment (#24409) Background: * Customers wish to control or modify the stack id of the Application stack to follow their project conventions within CDK. * In previous [fix](#24171), we had deprecated the stack id to push users towards using stack name as the main mechanism for stack identification. * Default stack name as per this [fix](#24171) has `Application Name` embedded in it. If customers wants to **update the application name**, then a new stack name as well as new stack id will be generated, which will eventually create a new Application in a new stack. Problem: * Application associator associates all stacks in scope to an application. * With `ApplicationName` in stack name, we will create an application within a stack. When customers attempt to update the name of the application, we will create a new stack and eventually create a new application, which is the first problem. * In this new application within the new stack, we will try to associate all stacks within the `app` scope, which is already associated to the original application in the original stack and hence cannot be further associated to the new application which will make the deployment of the stack with updated name fail. Fix: * We will continue to honor customer provided stack Name. * If no stack name is provided, then we will default it to `ApplicationAssociator-${hashValues(scope.node.addr)}-Stack`, which doesnt contain `Application Name`. Related Links: * Previous PR which introduced this bug: #24171 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…ter deployment (aws#24409) Background: * Customers wish to control or modify the stack id of the Application stack to follow their project conventions within CDK. * In previous [fix](aws#24171), we had deprecated the stack id to push users towards using stack name as the main mechanism for stack identification. * Default stack name as per this [fix](aws#24171) has `Application Name` embedded in it. If customers wants to **update the application name**, then a new stack name as well as new stack id will be generated, which will eventually create a new Application in a new stack. Problem: * Application associator associates all stacks in scope to an application. * With `ApplicationName` in stack name, we will create an application within a stack. When customers attempt to update the name of the application, we will create a new stack and eventually create a new application, which is the first problem. * In this new application within the new stack, we will try to associate all stacks within the `app` scope, which is already associated to the original application in the original stack and hence cannot be further associated to the new application which will make the deployment of the stack with updated name fail. Fix: * We will continue to honor customer provided stack Name. * If no stack name is provided, then we will default it to `ApplicationAssociator-${hashValues(scope.node.addr)}-Stack`, which doesnt contain `Application Name`. Related Links: * Previous PR which introduced this bug: aws#24171 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
stackName
tostackId
for Application stack, so the stack id will always be the same as stack name. Users wanting to control stack id can do so viastackName
.Closes #24160.
Background:
Note on backward-compatibility:
After this change, the
stackId
parameter can no longer be used to control the application stack id. The stack id will always match stack name, and the default stack name if not specified will beApplication-${APPLICATION_IDENTIFIER}-Stack
.${APPLICATION_IDENTIFIER}
is application name for CreateTargetApplication and application id for ExistingTargetApplication.If you created an application stack prior to aws-cdk release v2.64.0 and did not specify a stack id or name, you may run into the following error during deployment due to the creation attempt of a new stack with the same application:
To address this error, you can set the
stackName
value to match your existing stack. For example:This will result in the existing stack deploying with the previous name, and the id in CDK will reflect this same stack name.
Related links:
stackId
: feat(servicecatalogappregistry): stackId construct prop for ApplicationAssociator #22508By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license