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

Template that passes cfn-lint fails once deployed to CloudFormation #3070

Open
garysassano opened this issue Feb 23, 2024 · 3 comments
Open
Labels
new rule New rule v1 v1.X

Comments

@garysassano
Copy link

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.

@kddejong
Copy link
Contributor

Fixing this in v1 since its an easy fix.

@ArjunMenon-bit
Copy link

@kddejong Seems like you already fixed this issue? If not can you please assign this to me?

@kddejong
Copy link
Contributor

I did. This is fixed in the v1 branch. I have left these tickets until v1 is officially released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule New rule v1 v1.X
Projects
None yet
Development

No branches or pull requests

3 participants