cfn-lint
cfn-lint copied to clipboard
Template that passes `cfn-lint` fails once deployed to CloudFormation
CloudFormation Lint Version
0.85.2
What operating system are you using?
Ubuntu
Describe the bug
cfn-lint
isn't able to validate AWS::CloudFront::Distribution
correctly.
I had the following resource passing:
CloudFrontDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Enabled: true
Origins:
- DomainName: !GetAtt S3Bucket.DomainName
Id: !Sub "${BucketName}"
OriginAccessControlId: !Ref CloudFrontOriginAccessControl
S3OriginConfig: {}
DefaultCacheBehavior:
TargetOriginId: !Sub "${BucketName}"
ViewerProtocolPolicy: "redirect-to-https"
This is not valid though and the deploy would fail:
[ERROR] ResourceType=AWS::CloudFront::Distribution ResourceName=CloudFrontDistribution ResourceStatus=CREATE_FAILED StatusReason="Resource handler returned message: "Invalid request provided: AWS::CloudFront::Distribution: The parameter ForwardedValues is required.
In order for the template to be valid, you either have to provide ForwardedValues
(deprecated) or a CachePolicyId
.
Expected behavior
cfn-lint
warns me that there's a missing required field.
Reproduction template
See above.
Fixing this in v1 since its an easy fix.
@kddejong Seems like you already fixed this issue? If not can you please assign this to me?
I did. This is fixed in the v1 branch. I have left these tickets until v1 is officially released.