Add DNS propgation
This commit is contained in:
		
							
								
								
									
										60
									
								
								cloudformation/nakama/dns.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								cloudformation/nakama/dns.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,60 @@
 | 
			
		||||
AWSTemplateFormatVersion: "2010-09-09"
 | 
			
		||||
Description: Nakama DNS stack
 | 
			
		||||
Parameters:
 | 
			
		||||
  #------------------------
 | 
			
		||||
  # Deployment Information
 | 
			
		||||
  #------------------------
 | 
			
		||||
  environment:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description: Name of the environment
 | 
			
		||||
    Default: production
 | 
			
		||||
 | 
			
		||||
  #-----------------------
 | 
			
		||||
  # Route53 Configuration
 | 
			
		||||
  #-----------------------
 | 
			
		||||
  Domain:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description: The HostedZoneName to create the endpoint on
 | 
			
		||||
  SubDomain:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description: The subdomain to be used by nakama
 | 
			
		||||
 | 
			
		||||
  #-----------
 | 
			
		||||
  # Resources
 | 
			
		||||
  #-----------
 | 
			
		||||
  NakamaDns:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description: Nakama load balancer dns endpoint
 | 
			
		||||
  AdminDns:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description:  Application load balancer dns endpoint
 | 
			
		||||
 | 
			
		||||
Resources:
 | 
			
		||||
  AdminConsoleEndpoint:
 | 
			
		||||
    Type: AWS::Route53::RecordSet
 | 
			
		||||
    Properties:
 | 
			
		||||
      HostedZoneName: !Sub "${Domain}."
 | 
			
		||||
      Comment: !Sub 'DNS name for admin console'
 | 
			
		||||
      Name: !Sub "admin.${SubDomain}.${Domain}."
 | 
			
		||||
      Type: CNAME
 | 
			
		||||
      TTL: '300'
 | 
			
		||||
      ResourceRecords:
 | 
			
		||||
        - !Ref AdminDns
 | 
			
		||||
  NakamaEndpoint:
 | 
			
		||||
    Type: AWS::Route53::RecordSet
 | 
			
		||||
    Properties:
 | 
			
		||||
      HostedZoneName: !Sub "${Domain}."
 | 
			
		||||
      Comment: 'DNS name for nakama'
 | 
			
		||||
      Name: !Sub "${SubDomain}.${Domain}."
 | 
			
		||||
      Type: CNAME
 | 
			
		||||
      TTL: '300'
 | 
			
		||||
      ResourceRecords:
 | 
			
		||||
        - !Ref NakamaDns
 | 
			
		||||
 | 
			
		||||
Outputs:
 | 
			
		||||
  AdminEndpoint:
 | 
			
		||||
    Description: 'DNS name for admin console'
 | 
			
		||||
    Value: !Sub "admin.${SubDomain}.${Domain}."
 | 
			
		||||
  NakamaEndpoint:
 | 
			
		||||
    Description: 'DNS name for nakama'
 | 
			
		||||
    Value: !Sub "${SubDomain}.${Domain}."
 | 
			
		||||
@ -99,12 +99,37 @@ Parameters:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description: The CIDR used in the security group to secure the database
 | 
			
		||||
    Default: "0.0.0.0/0"
 | 
			
		||||
  Domain:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description: The domain to create the endpoint on (Must have an existing hosted zone ex. `example.com`) Leave blank to skip DNS.
 | 
			
		||||
    Default: ""
 | 
			
		||||
  SubDomain:
 | 
			
		||||
    Type: String
 | 
			
		||||
    Description: The subdomain to be used by nakama. (ex. `nakama.example.com`)
 | 
			
		||||
    Default: nakama
 | 
			
		||||
 | 
			
		||||
Conditions:
 | 
			
		||||
  CreateRdsStack: !Equals [!Ref CreateDatabase, "true"]
 | 
			
		||||
  CreateDns: !Not [!Equals [!Ref Domain, ""]]
 | 
			
		||||
 | 
			
		||||
Resources:
 | 
			
		||||
 | 
			
		||||
  #-----
 | 
			
		||||
  # DNS
 | 
			
		||||
  #-----
 | 
			
		||||
  DnsRecords:
 | 
			
		||||
    Condition: CreateDns
 | 
			
		||||
    Type: AWS::CloudFormation::Stack
 | 
			
		||||
    Properties:
 | 
			
		||||
      TemplateURL: !Sub 'https://s3.${AWS::Region}.amazonaws.com/sumu-stacks/nakama/${release}/cloudformation/nakama/dns.yaml'
 | 
			
		||||
      Parameters:
 | 
			
		||||
        environment: !Ref environment
 | 
			
		||||
        Domain: !Ref Domain
 | 
			
		||||
        SubDomain: !Ref SubDomain
 | 
			
		||||
        NakamaDns: !GetAtt PublicNLB.DNSName
 | 
			
		||||
        AdminDns: !GetAtt PublicALB.DNSName
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  #----------
 | 
			
		||||
  # Database
 | 
			
		||||
  #----------
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user