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(globalaccelerator): changing installLatestAwsSdk breaks Security Group reference #29620

Merged

Conversation

jingwy
Copy link
Contributor

@jingwy jingwy commented Mar 26, 2024

Issue # (if applicable)

Closes #23796

Reason for this change

In #23591 installLatestAwsSdk. This results in a resource update for custom resources. The custom resource that fetches the security groups does not have an onUpdate handler (https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-globalaccelerator/lib/_accelerator-security-group.ts#L32).

When the empty object is returned, this results in an update failure in
CloudFormation because the specific property isn't available and so it will fail with error below:

CustomResource attribute error: Vendor response doesn't contain SecurityGroups.0.GroupId key in object

When the update occurs, the response object does not have a SecurityGroups.0.GroupId field, resulting in failures when SecurityGroups is referenced.

Description of changes

Update the onCreate to onUpdate for custom resources to mitigate the CloudFormation update failure. Documentations: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.custom_resources.AwsCustomResource.html#oncreate.
Similar fix for Cognito: #23798

Description of how you validated changes

The integration test is updated with the latest assets.

Checklist


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 March 26, 2024 16:10
@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Mar 26, 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.

@github-actions github-actions bot added the bug This issue is a bug. label Mar 26, 2024
@jingwy jingwy force-pushed the jingwy-globalAccelerator-fix-for-custom-resources branch from 56687f5 to 508a6f6 Compare March 26, 2024 16:25
@jingwy
Copy link
Contributor Author

jingwy commented Mar 26, 2024

The pull request linter fails with the following errors:

❌ The title of this pull request does not follow the Conventional Commits format, see https://www.conventionalcommits.org/.

PRs must pass status checks before we can provide a meaningful review.

If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing Exemption Request and/or Clarification Request.

Hi, this is already fixed, and I saw the check was passed under action, not sure why it is not updated in the pr.

@aws-cdk-automation aws-cdk-automation added pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Mar 26, 2024
@jingwy
Copy link
Contributor Author

jingwy commented Mar 26, 2024

AWS CodeBuild CI Report

* CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv

* Commit ID: [508a6f6](https://github.com/aws/aws-cdk/commit/508a6f6e61f261707b6aa959fbe74afcbee0a1b5)

* Result: FAILED

* [Build Logs](https://2cl995f30a.execute-api.us-east-1.amazonaws.com/Prod/buildlogs?key=0978f4af-15ef-4258-96cb-71cb2c04f133%2Fbuild.log) (available for 30 days)

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

Hi, I have run the integ test locally and it passed with the udpated snapshot, not sure why the build was failing here due to integ test failure.

…laccelerator custom resource handler to fix cloudFormation update failure
@jingwy jingwy force-pushed the jingwy-globalAccelerator-fix-for-custom-resources branch from 508a6f6 to 06f0c0c Compare March 26, 2024 17:13
This was referenced Apr 1, 2024
@jingwy jingwy changed the title fix(globalaccelerator): changing installLatestAwsSdk breaks Security Group reference fix(globalaccelerator): change onCreate to onUpdate handler for globalaccelerator custom resource handler to fix cloudFormation update failure Apr 10, 2024
…laccelerator custom resource handler to fix cloudFormation update failure
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 10, 2024 20:19

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

@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 Apr 10, 2024
Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

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

Hi @jingwy, thank you for the fix.

I'm good with the code change because it appears to be the correct fix as per #23798 but just need a couple additional things before I'd like to merge this in.

  1. Could you add a new integration test which tests the specific case that was failing for you?

  2. Could you update the title of the PR to reflect the bug that you're fixing rather than the change that you're making?

@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 Apr 11, 2024
@jingwy jingwy force-pushed the jingwy-globalAccelerator-fix-for-custom-resources branch from 1f93b41 to e94fb82 Compare April 12, 2024 17:21
@jingwy jingwy changed the title fix(globalaccelerator): change onCreate to onUpdate handler for globalaccelerator custom resource handler to fix cloudFormation update failure fix(globalaccelerator): changing installLatestAwsSdk breaks Security Group reference Apr 12, 2024
@mergify mergify bot dismissed paulhcsun’s stale review April 12, 2024 17:22

Pull request has been modified.

@jingwy jingwy changed the title fix(globalaccelerator): changing installLatestAwsSdk breaks Security Group reference fix(globalaccelerator): changing installLatestAwsSdk breaks Security Group reference Apr 12, 2024
Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

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

Nice work @jingwy!

Approving as the new onUpdate behaviour is being covered already within the integ.globalaccelerator.ts.

Copy link
Contributor

mergify bot commented Apr 12, 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: e98047d
  • 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 ece7eb6 into aws:main Apr 12, 2024
9 checks passed
Copy link
Contributor

mergify bot commented Apr 12, 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p2 pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(cognito): Client Secret handler resource update breaks references
3 participants