You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The linter seems like it should validate that TargetOriginId must be set to an origin that exists in DistributionConfig.Origins array (please let me know and close if I'm incorrect). We're using AWS SAM to deploy the cloudformation template.
Currently this error is only caught (with a generic error message) at the time that cloudformation is deployed via sam deploy.
It would be great if this could be caught in static analysis - especially considering how updating cloudfront distributions via cloudformation is slow.
Example:
Resources:
ReverseProxyCloudfrontDistribution:
Type: 'AWS::CloudFront::Distribution'DependsOn:
- ReactProjectCloudfrontDistributionProperties:
DistributionConfig:
Enabled: trueComment: 'My Website Reverse Proxy'HttpVersion: http2Origins:
- Id: proxy-to-react-projectDomainName: !GetAtt ReactProjectCloudfrontDistribution.DomainNameCustomOriginConfig:
OriginProtocolPolicy: "https-only"
- Id: proxy-to-backend-ormDomainName: 'staging.mywebsite.com'CustomOriginConfig:
OriginProtocolPolicy: "https-only"DefaultCacheBehavior:
Compress: 'true'AllowedMethods:
- GET
- HEAD
- OPTIONSForwardedValues:
QueryString: true## !!!!!!!!!! SEE HERE !!!!!!!!!!# I made a (rather obvious) typo to show that the linter does not catch this# it should be set to `proxy-to-react-project`#TargetOriginId: proxy-to-REACTTTTTTT-projectViewerProtocolPolicy : allow-allReactProjectCloudfrontDistribution:
Type: 'AWS::CloudFront::Distribution'Properties:
# omitted for this example # not relevent to the issue being discussed
Error message when deploying:
"Invalid request
provided: One or more of
your origins or origin
groups do not exist.
(Service: CloudFront, Status
Code: 404, Request ID: 47dd8
910-c4e0-4c2c-9b55-6df586af6
56e)" (RequestToken: 57323dc
4-fb71-c4be-c472-e738ec6d3de
4, HandlerErrorCode:
InvalidRequest)
The text was updated successfully, but these errors were encountered:
cfn-lint version: v0.60.1
Description of issue.
The linter seems like it should validate that
TargetOriginId
must be set to an origin that exists inDistributionConfig.Origins
array (please let me know and close if I'm incorrect). We're using AWS SAM to deploy the cloudformation template.Currently this error is only caught (with a generic error message) at the time that cloudformation is deployed via
sam deploy
.It would be great if this could be caught in static analysis - especially considering how updating cloudfront distributions via cloudformation is slow.
Example:
Error message when deploying:
The text was updated successfully, but these errors were encountered: