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

fix(appconfig): deployment recreated on every cdk deployment #28782

Merged
merged 4 commits into from Feb 13, 2024

Conversation

corymhall
Copy link
Contributor

Every time I perform a CDK deployment, the logicalId hash of the deployment resource changes and causes the deployment resource to be deleted and recreated. I'm assuming it is because the configuration content is part of the hash creation and I am creating the content using lazy and at the time of the hash creation it is still a token.

Looking at the CloudFormation
docs
for the deployment resource, a change to any property causes a replacement so I don't think we need to control the recreation logic ourselves, we should just let CloudFormation do the resource replacement for us.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Every time I perform a CDK deployment, the logicalId hash of the
deployment resource changes and causes the deployment resource to be
deleted and recreated. I'm assuming it is because the configuration
`content` is part of the hash creation and I am creating the content
using `lazy` and at the time of the hash creation it is still a token.

Looking at the [CloudFormation
docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appconfig-deployment.html)
for the deployment resource, a change to _any_ property causes a
replacement so I don't think we need to control the recreation logic
ourselves, we should just let CloudFormation do the resource replacement
for us.
@aws-cdk-automation aws-cdk-automation requested a review from a team January 19, 2024 16:59
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Jan 19, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a 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.

@kaizencc kaizencc changed the title fix: deployment recreated on every cdk deployment fix(appconfig): deployment recreated on every cdk deployment Jan 19, 2024
@corymhall
Copy link
Contributor Author

Exemption Request. I re-ran the integ tests to update the snapshots.

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Jan 19, 2024
@kaizencc kaizencc added pr-linter/exempt-integ-test The PR linter will not require integ test changes and removed pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Jan 22, 2024
@kaizencc
Copy link
Contributor

We're going to have @chenjane-dev look at this one and give a first review

@aws-cdk-automation aws-cdk-automation dismissed their stale review January 22, 2024 16:40

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@@ -309,8 +306,7 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE
* @param environment The environment to deploy the configuration to
*/
public deploy(environment: IEnvironment) {
const logicalId = `Deployment${this.getDeploymentHash(environment)}`;
new CfnDeployment(this, logicalId, {
new CfnDeployment(this, `Deployment${environment.name!}`, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! One small change - can we hash the environment name instead of appending the name itself to the logical id? This might look better for reading the logical id's in the template.

new CfnDeployment(this, `Deployment${getHash(environment.name!)}`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes sense, updated!

Copy link
Contributor

@chenjane-dev chenjane-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

kaizencc
kaizencc previously approved these changes Feb 2, 2024
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Copy link
Contributor

mergify bot commented Feb 2, 2024

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-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 2, 2024
Copy link
Contributor

mergify bot commented Feb 2, 2024

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).

1 similar comment
Copy link
Contributor

mergify bot commented Feb 5, 2024

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).

@corymhall
Copy link
Contributor Author

@kaizencc it looks like something is wrong with mergify.

@mergify mergify bot dismissed kaizencc’s stale review February 13, 2024 21:15

Pull request has been modified.

Copy link
Contributor

mergify bot commented Feb 13, 2024

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 019ca6f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit a21731c into aws:main Feb 13, 2024
9 checks passed
GavinZZ pushed a commit that referenced this pull request Feb 22, 2024
Every time I perform a CDK deployment, the logicalId hash of the deployment resource changes and causes the deployment resource to be deleted and recreated. I'm assuming it is because the configuration `content` is part of the hash creation and I am creating the content using `lazy` and at the time of the hash creation it is still a token.

Looking at the [CloudFormation
docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appconfig-deployment.html) for the deployment resource, a change to _any_ property causes a replacement so I don't think we need to control the recreation logic ourselves, we should just let CloudFormation do the resource replacement for us.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants