-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(aws-cloudfront): Fix loggingConfig being ignored #809
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ac09b96
fix(aws-cloudfront): Fix loggingConfig being ignored
43516c5
Update docstring to be in line with standards
rix0rrr 7a44981
Fix docstring format for LoggingConfiguration
rix0rrr cb52b3a
Fix whitespace errors
rix0rrr 24723ed
46ceadf
Merge branch 'master' into cloudfront-s3-fix
b8a4e14
1535e48
bec5142
Fix parent for on-the-spot created Logging Bucket
rix0rrr ed88a02
Assign to this.loggingBucket
rix0rrr a1567ab
Update test expectation
rix0rrr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| { | ||
| "Resources": { | ||
| "Bucket83908E77": { | ||
| "Type": "AWS::S3::Bucket" | ||
| }, | ||
| "AnAmazingWebsiteProbably2LoggingS3BucketB2C21612": { | ||
| "Type": "AWS::S3::Bucket" | ||
| }, | ||
| "AnAmazingWebsiteProbablyCFDistribution47E3983B": { | ||
| "Type": "AWS::CloudFront::Distribution", | ||
| "Properties": { | ||
| "DistributionConfig": { | ||
| "CacheBehaviors": [], | ||
| "DefaultCacheBehavior": { | ||
| "AllowedMethods": [ | ||
| "GET", | ||
| "HEAD" | ||
| ], | ||
| "CachedMethods": [ | ||
| "GET", | ||
| "HEAD" | ||
| ], | ||
| "ForwardedValues": { | ||
| "Cookies": { | ||
| "Forward": "none" | ||
| }, | ||
| "QueryString": false | ||
| }, | ||
| "TargetOriginId": "origin1", | ||
| "ViewerProtocolPolicy": "redirect-to-https" | ||
| }, | ||
| "DefaultRootObject": "index.html", | ||
| "Enabled": true, | ||
| "HttpVersion": "http2", | ||
| "IPV6Enabled": true, | ||
| "Origins": [ | ||
| { | ||
| "CustomOriginConfig": { | ||
| "HTTPPort": 80, | ||
| "HTTPSPort": 443, | ||
| "OriginKeepaliveTimeout": 5, | ||
| "OriginProtocolPolicy": "https-only", | ||
| "OriginReadTimeout": 30, | ||
| "OriginSSLProtocols": [ | ||
| "TLSv1.2" | ||
| ] | ||
| }, | ||
| "DomainName": "brelandm.a2z.com", | ||
| "Id": "origin1", | ||
| "OriginCustomHeaders": [ | ||
| { | ||
| "HeaderName": "X-Custom-Header", | ||
| "HeaderValue": "somevalue" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "PriceClass": "PriceClass_100", | ||
| "ViewerCertificate": { | ||
| "CloudFrontDefaultCertificate": true | ||
| }, | ||
| "Logging": { | ||
| "Bucket": { | ||
| "Fn::GetAtt":["Bucket83908E77","DomainName"] | ||
| }, | ||
| "IncludeCookies": true, | ||
| "Prefix": "test-prefix" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "AnAmazingWebsiteProbably2CFDistribution7C1CCD12": { | ||
| "Type": "AWS::CloudFront::Distribution", | ||
| "Properties": { | ||
| "DistributionConfig": { | ||
| "CacheBehaviors": [], | ||
| "DefaultCacheBehavior": { | ||
| "AllowedMethods": [ | ||
| "GET", | ||
| "HEAD" | ||
| ], | ||
| "CachedMethods": [ | ||
| "GET", | ||
| "HEAD" | ||
| ], | ||
| "ForwardedValues": { | ||
| "Cookies": { | ||
| "Forward": "none" | ||
| }, | ||
| "QueryString": false | ||
| }, | ||
| "TargetOriginId": "origin1", | ||
| "ViewerProtocolPolicy": "redirect-to-https" | ||
| }, | ||
| "DefaultRootObject": "index.html", | ||
| "Enabled": true, | ||
| "HttpVersion": "http2", | ||
| "IPV6Enabled": true, | ||
| "Origins": [ | ||
| { | ||
| "CustomOriginConfig": { | ||
| "HTTPPort": 80, | ||
| "HTTPSPort": 443, | ||
| "OriginKeepaliveTimeout": 5, | ||
| "OriginProtocolPolicy": "https-only", | ||
| "OriginReadTimeout": 30, | ||
| "OriginSSLProtocols": [ | ||
| "TLSv1.2" | ||
| ] | ||
| }, | ||
| "DomainName": "brelandm.a2z.com", | ||
| "Id": "origin1", | ||
| "OriginCustomHeaders": [ | ||
| { | ||
| "HeaderName": "X-Custom-Header", | ||
| "HeaderValue": "somevalue" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "PriceClass": "PriceClass_100", | ||
| "ViewerCertificate": { | ||
| "CloudFrontDefaultCertificate": true | ||
| }, | ||
| "Logging": { | ||
| "Bucket": { | ||
| "Fn::GetAtt":["AnAmazingWebsiteProbably2LoggingS3BucketB2C21612","DomainName"] | ||
| }, | ||
| "IncludeCookies": false | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import s3 = require('@aws-cdk/aws-s3'); | ||
| import cdk = require('@aws-cdk/cdk'); | ||
| import cloudfront = require('../lib'); | ||
|
|
||
| const app = new cdk.App(process.argv); | ||
|
|
||
| const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); | ||
|
|
||
| const loggingBucket = new s3.Bucket(stack, 'Bucket'); | ||
|
|
||
| new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { | ||
| originConfigs: [ | ||
| { | ||
| originHeaders: { | ||
| "X-Custom-Header": "somevalue", | ||
| }, | ||
| customOriginSource: { | ||
| domainName: "brelandm.a2z.com", | ||
| }, | ||
| behaviors: [ | ||
| { | ||
| isDefaultBehavior: true, | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| loggingConfig: { | ||
| bucket: loggingBucket, | ||
| includeCookies: true, | ||
| prefix: 'test-prefix' | ||
| } | ||
| }); | ||
|
|
||
| new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably2', { | ||
| originConfigs: [ | ||
| { | ||
| originHeaders: { | ||
| "X-Custom-Header": "somevalue", | ||
| }, | ||
| customOriginSource: { | ||
| domainName: "brelandm.a2z.com", | ||
| }, | ||
| behaviors: [ | ||
| { | ||
| isDefaultBehavior: true, | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| loggingConfig: {} | ||
| }); | ||
|
|
||
| process.stdout.write(app.run()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.expected.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "Resources": { | ||
| "MyBucketF68F3FF0": { | ||
| "Type": "AWS::S3::Bucket" | ||
| } | ||
| }, | ||
| "Outputs": { | ||
| "RealBucketDomain": { | ||
| "Value": { | ||
| "Fn::GetAtt":["MyBucketF68F3FF0","DomainName"] | ||
| }, | ||
| "Export": { | ||
| "Name": "aws-cdk-s3-urls:RealBucketDomain" | ||
| } | ||
| }, | ||
| "ImportedBucketDomain": { | ||
| "Value": "my-bucket-test.s3.amazonaws.com", | ||
| "Export": { | ||
| "Name": "aws-cdk-s3-urls:ImportedBucketDomain" | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import cdk = require('@aws-cdk/cdk'); | ||
| import s3 = require('../lib'); | ||
|
|
||
| class TestStack extends cdk.Stack { | ||
| constructor(parent: cdk.App, id: string) { | ||
| super(parent, id); | ||
|
|
||
| /// !show | ||
| const bucket = new s3.Bucket(this, 'MyBucket'); | ||
| const bucket2 = s3.Bucket.import(this, "MyBucket2", { | ||
| bucketArn: "arn:aws:s3:::my-bucket-test" | ||
| }); | ||
|
|
||
| new cdk.Output(this, 'RealBucketDomain', { value: bucket.domainName }); | ||
| new cdk.Output(this, 'ImportedBucketDomain', { value: bucket2.domainName }); | ||
| /// !hide | ||
| } | ||
| } | ||
|
|
||
| const app = new cdk.App(process.argv); | ||
| new TestStack(app, 'aws-cdk-s3-urls'); | ||
| process.stdout.write(app.run()); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.