File tree Expand file tree Collapse file tree 3 files changed +54
-1
lines changed
Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 55 "CodeBranch" : $env.GITHUB_REF_SLUG_CS,
66 "UserPoolName" : $secrets.USER_POOL_NAME,
77 "UserPoolDomainName" : $secrets.USER_POOL_DOMAIN_NAME,
8- "DnsZoneId " : " /org/dns/ZoneId " ,
8+ "ParentDnsZoneId " : $secrets.PARENT_DNS_ZONE_ID ,
99 "TargetOuIds" : $secrets.DEPLOYMENT_TARGET_OU,
1010 "TargetRegions" : " us-east-1" ,
1111 "TargetAccountIds" : $secrets.DEPLOYMENT_TARGET_ACCOUNT_ID,
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ Parameters:
55 UserPoolName :
66 Type : String
77 Description : Name of UserPool
8+ UserPoolDomainName :
9+ Type : String
10+ Description : Name of UserPool Domain
11+ ParentDnsZoneId :
12+ Type : String
13+ Description : " Route53 Hosted Zone ID"
814
915Resources :
1016 UserPool :
@@ -15,3 +21,40 @@ Resources:
1521 UserPoolName : !Ref UserPoolName
1622 AdminCreateUserConfig :
1723 AllowAdminCreateUserOnly : true
24+
25+ # DNS
26+ #
27+ # Cognito site verification requires either an A record at the root of the site's domain or a
28+ # delegation to another zone. Rathert than mess with the serverlessops.io apex record we
29+ # create a new zone for the user pool domain and add a delegation set to the parent zone.
30+
31+ AuthnzZone :
32+ Type : " AWS::Route53::HostedZone"
33+ Properties :
34+ Name : !Ref UserPoolDomainName
35+ HostedZoneConfig :
36+ Comment : ServerlessOps Authnz
37+
38+ AuthnzDelegationSet :
39+ Type : " AWS::Route53::RecordSet"
40+ Properties :
41+ HostedZoneId : !Ref ParentDnsZoneId
42+ Name : !Ref UserPoolDomainName
43+ Type : NS
44+ TTL : ' 3600'
45+ ResourceRecords : !GetAtt AuthnzZone.NameServers
46+
47+ SiteCertificate :
48+ Type : AWS::CertificateManager::Certificate
49+ DependsOn : AuthnzZone
50+ Properties :
51+ DomainName : !Ref UserPoolDomainName
52+ ValidationMethod : DNS
53+
54+ UserPoolDomain :
55+ Type : AWS::Cognito::UserPoolDomain
56+ Properties :
57+ Domain : !Ref UserPoolDomainName
58+ UserPoolId : !Ref UserPool
59+ CustomDomainConfig :
60+ CertificateArn : !Ref SiteCertificate
Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ Parameters:
1818 UserPoolName :
1919 Type : String
2020 Description : Name of UserPool
21+ UserPoolDomainName :
22+ Type : String
23+ Description : Name of UserPool Domain
24+ ParentDnsZoneId :
25+ Type : String
26+ Description : " Route53 Hosted Zone ID of parent zone"
2127
2228Resources :
2329 UserPoolStackSet :
@@ -28,6 +34,10 @@ Resources:
2834 Parameters :
2935 - ParameterKey : UserPoolName
3036 ParameterValue : !Ref UserPoolName
37+ - ParameterKey : UserPoolDomainName
38+ ParameterValue : !Ref UserPoolDomainName
39+ - ParameterKey : ParentDnsZoneId
40+ ParameterValue : !Ref ParentDnsZoneId
3141 StackInstancesGroup :
3242 - DeploymentTargets :
3343 AccountFilterType : INTERSECTION
You can’t perform that action at this time.
0 commit comments