aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

fix(cloudfront): add region to autogenerated name for cloudfront origin request policy

Open rclark opened this issue 7 months ago • 5 comments

Issue # (if applicable)

Closes #34336

Reason for this change

So that a stack defining an origin request policy can be easily deployed into more than one region in a single account.

Description of changes

Followed the same naming convention already in place for cache policies, which was added in #13737

Describe any new or updated permissions being added

Description of how you validated changes

Adjusted an existing unit test to recognize the new name

Checklist


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

rclark avatar May 03 '25 23:05 rclark

Exemption Request:

Fixes must contain a change to an integration test file and the resulting snapshot.

The existing integration test for cache policy & origin request policy explicitly set the resource name properties

https://github.com/aws/aws-cdk/blob/7330f91b1aa8360db29384c823948596d1370ca7/packages/%40aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.ts#L33

Not sure if you'd want to see the autogenerated name behavior in the integration suite or not?

rclark avatar May 03 '25 23:05 rclark

Exemption Request:

Fixes must contain a change to an integration test file and the resulting snapshot.

The existing integration test for cache policy & origin request policy explicitly set the resource name properties

https://github.com/aws/aws-cdk/blob/7330f91b1aa8360db29384c823948596d1370ca7/packages/%40aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.ts#L33

Not sure if you'd want to see the autogenerated name behavior in the integration suite or not?

Thanks for identifying the missing integ test gap, i think we should add new one for this use-case.

shikha372 avatar May 06 '25 18:05 shikha372

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing

To prevent automatic closure:

  • Resume work on the PR
  • OR request an exemption by adding a comment containing 'Exemption Request' with justification e.x "Exemption Request: "
  • OR request clarification by adding a comment containing 'Clarification Request' with a question e.x "Clarification Request: "

This PR will automatically close in 14 days if no action is taken.

aws-cdk-automation avatar May 25 '25 00:05 aws-cdk-automation

Clarification Request: @shikha372 this would be my first contribution to the repo, I'm having trouble with the integration test suite. According to the INTEGRATION_TESTS.md file, I should

  1. Add a new .ts test file. I added packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies-autonamed.ts as a copy of the existing test for cloudfront policies. See https://github.com/aws/aws-cdk/pull/34348/commits/d622e71883aaffb49c6f701a228586f4489fa292.
  2. Run yarn integ --update-on-failed integ.distribution-policies-autonamed.js, with .js instead of .ts

This doesn't seem to find the test:

yarn integ --update-on-failed integ.distribution-policies-autonamed.js
yarn run v1.22.22
$ integ-runner --language javascript --update-on-failed integ.distribution-policies-autonamed.js
No such integ test: integ.distribution-policies-autonamed.js
Available tests: aws-ec2/test/integ.placement-group.js aws-events-targets/test/batch/integ.job-definition-events.js aws-s3-deployment/test/integ.bucket-deployment-signcontent.js aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js aws-stepfunctions-tasks/test/batch/integ.submit-job.js pipelines/test/integ.newpipeline-with-file-system-locations.js

This is running from packages/@aws-cdk-testing/framework-integ as the working directory. I also tried passing the test name as an absolute path, with the same result.


Beyond that operational concern, since what I'd be trying to test here is autogeneration of resource names, snapshot tests won't be able to expect the output to have a stable, consistent name, right? Is there something I'll have to do to allow for randomness in parts of the autogenerated resource names?

rclark avatar Jun 01 '25 18:06 rclark

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 38aab9095cba5f1762c9d41141d2075b7b2cdc64
  • Result: FAILED
  • Build Logs (available for 30 days)

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

aws-cdk-automation avatar Jun 17 '25 17:06 aws-cdk-automation