-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(aws-cloudfront): properly support loggingConfig (#809)
feat(aws-s3): Add support for domainName on BucketRef instead of just Bucket LoggingConfiguration now requires bucket instead of it being optional. There is no point to including a LoggingConfiguration without a bucket (no-breaking). Fixes #721
- Loading branch information
1 parent
86a55a9
commit a09afc4
Showing
6 changed files
with
285 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
141 changes: 141 additions & 0 deletions
141
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json
This file contains 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,141 @@ | ||
{ | ||
"Resources": { | ||
"Bucket83908E77": { | ||
"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, | ||
"Logging": { | ||
"Bucket": { | ||
"Fn::GetAtt": [ | ||
"Bucket83908E77", | ||
"DomainName" | ||
] | ||
}, | ||
"IncludeCookies": true, | ||
"Prefix": "test-prefix" | ||
}, | ||
"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 | ||
} | ||
} | ||
} | ||
}, | ||
"AnAmazingWebsiteProbably2LoggingBucket222F7CE9": { | ||
"Type": "AWS::S3::Bucket" | ||
}, | ||
"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, | ||
"Logging": { | ||
"Bucket": { | ||
"Fn::GetAtt": [ | ||
"AnAmazingWebsiteProbably2LoggingBucket222F7CE9", | ||
"DomainName" | ||
] | ||
}, | ||
"IncludeCookies": false | ||
}, | ||
"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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts
This file contains 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 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 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 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()); |