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-alpha): extensions always create cdk diff #28264

Merged
merged 6 commits into from
Dec 9, 2023

Conversation

chenjane-dev
Copy link
Contributor

Fixing extensions CDK diff since before it would always generate a new diff even if nothing changed.

Closes #27676.


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

@aws-cdk-automation aws-cdk-automation requested a review from a team December 5, 2023 19:47
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK labels Dec 5, 2023
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 5, 2023
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Looks good overall 👍
I left some notes for potential improvements

packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts Outdated Show resolved Hide resolved
@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 Dec 7, 2023
...(options?.parameters ? { parameters: options.parameters } : {}),
});
this.addExtensionAssociation(extension, options);
}

private addExtensionAssociation(extension: IExtension, options?: ExtensionOptions) {
new CfnExtensionAssociation(this.scope, `AssociationResource${this.getExtensionAssociationHash(extension)}`, {
const versionNumber = options?.latestVersionNumber ? options?.latestVersionNumber + 1 : 1;
const name = extension.name ?? this.getExtensionDefaultName();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const name = extension.name ?? this.getExtensionDefaultName();
const name = extension.name ?? options?.name ?? this.getExtensionDefaultName();

name can be passed via options as well.
I think that getExtensionDefaultName should be used here as well for consistency.

To avoid this default to chaining after initialization we could think about making this and this required and use getExtensionDefaultName for imported extensions.
This may be a better approach, not sure how much refactoring it would require.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We actually don't need the options parameter here, I just got rid of it.

For the second point, the scope in these two places are different. In the link you attached, the user would pass in the logical id which might be something like MyExtension so here adding the -Extension there would be redundant. Here the scope is the parent so adding the -Extension prevents it from being named the same as the parent. For requiring the name as a parameter, this goes against the CDK guidelines as we want to try to take as much of the work off the user. This was additionally a customer pain point when working with the L1 constructs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok clear, thanks for the follow-up and the parameter cleanup 👍

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 8, 2023
@vinayak-kukreja vinayak-kukreja self-assigned this Dec 8, 2023
@vinayak-kukreja vinayak-kukreja changed the title fix(appconfig): extensions always create cdk diff fix(appconfig-alpha): extensions always create cdk diff Dec 8, 2023
vinayak-kukreja
vinayak-kukreja previously approved these changes Dec 8, 2023
Copy link
Contributor

@vinayak-kukreja vinayak-kukreja left a comment

Choose a reason for hiding this comment

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

Hey @chenjane-dev thank you for contributing to the cdk. And, @lpizzinidev thank you for reviewing the pr.

Copy link
Contributor

mergify bot commented Dec 8, 2023

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

@vinayak-kukreja
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Dec 8, 2023

update

❌ Mergify doesn't have permission to update

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/yarn-upgrade.yml without workflows permission

@mergify mergify bot dismissed vinayak-kukreja’s stale review December 8, 2023 21:21

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

Copy link
Contributor

mergify bot commented Dec 9, 2023

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

@mergify mergify bot merged commit 2075559 into aws:main Dec 9, 2023
10 checks passed
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p2 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-appconfig-alpha: SQS Extension association always creates cdk diff
4 participants