0

I am having some issues w/ using CloudFormation and CloudFront. I have been using the AWS resources to form my template, found here

   "OpenVPNCloudFront" : {
       "Type" : "AWS::CloudFront::Distribution",
       "Properties": {
           "DistributionConfig" : {
               "Origins" : [ {
                   "DomainName" : {
                       "Fn::Join" : [ "", [
                          {"Ref" : "AWS::StackName"}, ".",
                          {"Ref" : "HostedZone"}
                      ] ]
                   },
                   "Id" : "OpenVPNCF",
                   "CustomOriginConfig" : {
                       "HTTPSPort" : "443",
                       "OriginProtocolPolicy" : "https-only"
                   }
               } ],
             "Enabled" : "true",
             "Aliases" : [{"Ref" : "DomainName"} ],
           },
           "ViewerCertificate": { "CloudFrontDefaultCertificate" : "true" }
       }
  },
   More JSON here

I keep getting Template validation error: Template format error: JSON not well-formed. (line 147, column 17) which is right after the DistributionConfig. I have tried putting this through JSONlint but did not get any hints on it and its getting increasingly frusterating for me. Can someone please tell me what may be wrong with this JSON template?

ryekayo
  • 472
  • 5
  • 14

1 Answers1

0

This line:

"ViewerCertificate": { "CloudFrontDefaultCertificate" : "true" }

Is out of place.

If you look in this official AWS resource, you can see that "ViewerCertificate" is not a valid property of "AWS::CloudFront::Distribution".

Itai Ganot
  • 10,644
  • 29
  • 93
  • 146
  • Where should that be in the snippet? I thought it was in the right place from referencing the AWS docs. – ryekayo Jul 18 '18 at 14:52
  • Edited my answer, not sure where it should be, but it definitely shouldn't be where you've placed it. – Itai Ganot Jul 18 '18 at 14:56