Skip to content

Commit 08b2efd

Browse files
committed
Create dedicated cert
1 parent 4433761 commit 08b2efd

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ setup-predeploy:
2424
source venv/bin/activate
2525
pip install cfn-flip==1.2.2
2626

27+
clean:
28+
rm -rf *.zip source/witch/nodejs/node_modules/
29+
2730
test-cfn:
2831
cfn_nag templates/*.yaml --blacklist-path ci/cfn_nag_blacklist.yaml
2932

@@ -41,5 +44,7 @@ package-static:
4144
cd source/witch && zip -r ../../witch.zip nodejs
4245

4346
package-function:
47+
make clean
4448
make package-static
4549
cd source/secured-headers/ && zip -r ../../s-headers.zip index.js
50+

templates/acm-certificate.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Parameters:
1111
Type: String
1212
CopyFunction:
1313
Type: String
14+
SubDomain:
15+
Type: String
1416

1517
Resources:
1618
CopyCustomResource:
@@ -21,7 +23,7 @@ Resources:
2123
Certificate:
2224
Type: Custom::Certificate
2325
Properties:
24-
DomainName: !Sub '*.${DomainName}'
26+
DomainName: !Sub '${SubDomain}.${DomainName}'
2527
Region: !Ref Region
2628
ValidationMethod: DNS
2729
ServiceToken: !Ref 'CFNCustomProvider'
@@ -36,7 +38,7 @@ Resources:
3638
Type: Custom::CertificateDNSRecord
3739
Properties:
3840
CertificateArn: !Ref Certificate
39-
DomainName: !Sub '*.${DomainName}'
41+
DomainName: !Sub '${SubDomain}.${DomainName}'
4042
ServiceToken: !Ref 'CFNCustomProvider'
4143

4244
DomainValidationRecord:

templates/main.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Resources:
3939
Properties:
4040
TemplateURL: ./acm-certificate.yaml
4141
Parameters:
42+
SubDomain: !Ref SubDomain
4243
DomainName: !Ref DomainName
4344
CFNCustomProvider: !GetAtt CustomResourceStack.Outputs.CFNCustomProvider
4445
CopyFunction: !GetAtt CustomResourceStack.Outputs.CopyFunction
@@ -64,6 +65,8 @@ Resources:
6465
Value: ACFS3
6566

6667
Outputs:
68+
SolutionVersion:
69+
Value: !FindInMap [Solution, Constants, Version]
6770
CFNCustomProvider:
6871
Description: ACM helper function
6972
Value: !GetAtt CustomResourceStack.Outputs.CFNCustomProvider
@@ -94,5 +97,3 @@ Outputs:
9497
CloudFrontDomainName:
9598
Description: Website address
9699
Value: !GetAtt CloudFrontStack.Outputs.CloudFrontDomainName
97-
SolutionVersion:
98-
Value: !FindInMap [Solution, Constants, Version]

0 commit comments

Comments
 (0)