Trying to provision a static website bucket that's distributed by CloudFront.
The following CloudFormation template works if I omit the Logging configuration for the distribution:
{
...
"PrimeBucket": {
"Properties": {
"AccessControl": "PublicRead",
"WebsiteConfiguration": {
"ErrorDocument": "error.html",
"IndexDocument": "index.html"
}
},
"Type": "AWS::S3::Bucket"
},
"PrimeBucketDistribution": {
"Properties": {
"DistributionConfig": {
"DefaultCacheBehavior": {
"AllowedMethods": [
"GET",
"HEAD",
"OPTIONS"
],
"ForwardedValues": {
"QueryString": "false"
},
"TargetOriginId": "BucketOrigin",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": "true",
"Logging": {
"Bucket": {
"Ref": "PrimeBucketLogs"
},
"IncludeCookies": "false"
},
"Origins": [
{
"DomainName": {
"Fn::GetAtt": [
"PrimeBucket",
"DomainName"
]
},
"Id": "BucketOrigin",
"S3OriginConfig": {}
}
]
}
},
"Type": "AWS::CloudFront::Distribution"
},
"PrimeBucketLogs": {
"Type": "AWS::S3::Bucket"
}
}
If I include Logging I get the error:
The parameter Logging Bucket does not refer to a valid S3 bucket.
Is there any extra magic that needs to be applied to the logging bucket in order for it to be compatible with CloudFront? Couldn't find anything in the docs.