Skip to content

fix(cloudfront): fromOriginAccessIdentityName is a misnomer#20772

Merged
mergify[bot] merged 5 commits intoaws:mainfrom
dbartholomae:fix_cloudfront_OriginAccessIdentiy_naming
Jul 1, 2022
Merged

fix(cloudfront): fromOriginAccessIdentityName is a misnomer#20772
mergify[bot] merged 5 commits intoaws:mainfrom
dbartholomae:fix_cloudfront_OriginAccessIdentiy_naming

Conversation

@dbartholomae
Copy link
Copy Markdown
Contributor

@dbartholomae dbartholomae commented Jun 17, 2022

fixes #20141


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

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

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Jun 17, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team June 17, 2022 09:00
@github-actions github-actions bot added the p2 label Jun 17, 2022
@dbartholomae
Copy link
Copy Markdown
Contributor Author

Fixes #20141

@dbartholomae dbartholomae force-pushed the fix_cloudfront_OriginAccessIdentiy_naming branch 9 times, most recently from 9506d28 to 5948f8c Compare June 17, 2022 16:00
@dbartholomae
Copy link
Copy Markdown
Contributor Author

I had to take two shortcuts:

  1. I didn't add a test for the originAccessIdentityId property as I also didn't find a test for originAccessIdentityName and couldn't find a good way to test it that goes over what TypeScript already guarantees (that it is a non-empty string).
  2. I had to remove the test for fromOriginAccessIdentityName as calling deprecated functions from a test currently is an error. It could make sense to deactivate this check or at least add some way to deactivate it inside a test.

For both, I'm happy about suggestions, but if CI is green, then from my point of view, the PR can already be merged as-is.

Copy link
Copy Markdown
Contributor

@peterwoodworth peterwoodworth left a comment

Choose a reason for hiding this comment

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

Like you said, It would be nice to verify that the deprecated prop works. We have a testDeprecated which behaves similarly to test. Check out an example of this here https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-elasticsearch/test/domain.test.ts

@mergify mergify bot dismissed peterwoodworth’s stale review June 18, 2022 08:19

Pull request has been modified.

@dbartholomae
Copy link
Copy Markdown
Contributor Author

I've added a test for the now deprecated fromOriginAccessIdentityName (for now as a fixup for easier review, will rebase once the PR is approved from your side), but I'm not sure how to best write tests for the properties. I could test that they exist and are strings - but this is actually already assured by TypeScript. And for the exact content I'm not sure how to predict this, as it contains a random letter-number-combination if I'm not mistaken.

@dbartholomae dbartholomae force-pushed the fix_cloudfront_OriginAccessIdentiy_naming branch from eaf082c to add8357 Compare June 18, 2022 14:53
@peterwoodworth
Copy link
Copy Markdown
Contributor

I think the tests you have here are plenty sufficient @dbartholomae,

I'll give this an approval once you make your desired rebase

@dbartholomae dbartholomae force-pushed the fix_cloudfront_OriginAccessIdentiy_naming branch from add8357 to d9a9f71 Compare June 29, 2022 11:09
@dbartholomae
Copy link
Copy Markdown
Contributor Author

@peterwoodworth here you are :)

@peterwoodworth peterwoodworth added pr/do-not-merge This PR should not be merged at this time. labels Jun 30, 2022
@peterwoodworth peterwoodworth changed the title Fix cloudfront origin access identiy naming fix(cloudfront): fromOriginAccessIdentityName is a misnomer Jun 30, 2022
Copy link
Copy Markdown
Contributor

@peterwoodworth peterwoodworth left a comment

Choose a reason for hiding this comment

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

LGTM! going to let another team member take a quick peek to double check that deprecation was handled properly here, then it should be merged

@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort labels Jun 30, 2022
Copy link
Copy Markdown
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.

The deprecation here looks fine @peterwoodworth, @dbartholomae. One call out for something weird in the Cloudformation docs -- not sure why a return value exists in the docs and is also "not supported".

* @attribute
* @deprecated use originAccessIdentityId instead
*/
public get originAccessIdentityName() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do want to call out that Id as an @attribute return value is allegedly "not currently supported by CloudFormation".

If true, and Cloudformation does not actually return this value, I think we should @deprecate public get originAccessIdentiyName and not supply an alternative. It all depends on whether cloudformation does return the Id, which would require someone to test this out themselves and confirm.

Screen Shot 2022-07-01 at 10 49 07 AM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Or if they would support it in the future?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tested it and it's currently supported if I create an OAI ID and reference the attribute in a CfnOutput. Seems to just work

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

going to remove the label and let this merge

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

correction - we just use ref here which does return the OAI Id. But, using the ID attribute still works will return the exact same value as ref so...

@peterwoodworth peterwoodworth removed the pr/do-not-merge This PR should not be merged at this time. label Jul 1, 2022
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jul 1, 2022

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
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: f92eedb
  • 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 3e58e5a into aws:main Jul 1, 2022
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jul 1, 2022

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

daschaa pushed a commit to daschaa/aws-cdk that referenced this pull request Jul 9, 2022
fixes aws#20141

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*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

bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@aws-cdk/cloudfront: OriginAccessIdentity mixes up id and name

5 participants