Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
fix: update cloudfront protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
arantespp committed Feb 1, 2022
1 parent 72c38a6 commit 13678cd
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/cli/src/deploy/staticApp/staticApp.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,14 @@ const getCloudFrontTemplate = ({
};

if (acm) {
const acmRegex = /^arn:aws:acm:[-a-z0-9]+:\d{12}:certificate\/[-a-z0-9]+$/;

const acmCertificateArn = acmRegex.test(acm)
? acm
: {
'Fn::ImportValue': acm,
};

/**
* Add ACM to CloudFront template.
*/
Expand All @@ -900,13 +908,11 @@ const getCloudFrontTemplate = ({
.DistributionConfig,
Aliases: aliases || { Ref: 'AWS::NoValue' },
ViewerCertificate: {
AcmCertificateArn: /^arn:aws:acm:[-a-z0-9]+:\d{12}:certificate\/[-a-z0-9]+$/.test(
acm,
)
? acm
: {
'Fn::ImportValue': acm,
},
AcmCertificateArn: acmCertificateArn,
/**
* AWS CloudFront recommendation.
*/
MinimumProtocolVersion: 'TLSv1.2_2021',
SslSupportMethod: 'sni-only',
},
};
Expand Down

0 comments on commit 13678cd

Please sign in to comment.