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(cloudfront): all origin access identities have identical names #9829

Merged
merged 2 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-cloudfront-origins/lib/s3-origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class S3BucketOrigin extends cloudfront.OriginBase {

public bind(scope: cdk.Construct, options: cloudfront.OriginBindOptions): cloudfront.OriginBindConfig {
if (!this.originAccessIdentity) {
this.originAccessIdentity = new cloudfront.OriginAccessIdentity(scope, 'S3Origin');
this.originAccessIdentity = new cloudfront.OriginAccessIdentity(scope, 'S3Origin', {
comment: `Access identity for ${options.originId}`,
njlynch marked this conversation as resolved.
Show resolved Hide resolved
});
this.bucket.grantRead(this.originAccessIdentity);
}
return super.bind(scope, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
"Properties": {
"CloudFrontOriginAccessIdentityConfig": {
"Comment": "Allows CloudFront to reach the bucket"
"Comment": "Access identity for cloudfrontorigingroupDistributionOrigin137659A54"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
"Properties": {
"CloudFrontOriginAccessIdentityConfig": {
"Comment": "Allows CloudFront to reach the bucket"
"Comment": "Access identity for cloudfronts3originDistributionOrigin1741C4E95"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('With bucket', () => {

expect(stack).toHaveResourceLike('AWS::CloudFront::CloudFrontOriginAccessIdentity', {
CloudFrontOriginAccessIdentityConfig: {
Comment: 'Allows CloudFront to reach the bucket',
Comment: 'Access identity for StackDistOrigin15754CE84',
},
});
expect(stack).toHaveResourceLike('AWS::S3::BucketPolicy', {
Expand Down