3. Add Variable to environment Module variables.tf#
variable "new_subdomain"{
description ="Subdomain for new service"
type = string
default=""}
variable "new_target"{
description ="Target for new service"
type = string
default=""}
4. Add Resource to firebase-dns.tf (or new .tf file)#
# Primary domain
resource "aws_route53_record""new_service"{
count =var.enable_route53 &&var.enable_primary_dns &&var.new_subdomain !=""?1:0
zone_id =var.hosted_zone_id
name =var.new_subdomain
type ="CNAME"
ttl ="60"
records =[var.new_target]
allow_overwrite =true}
# Secondary domain
resource "aws_route53_record""new_service_secondary"{
count =var.enable_route53 &&var.secondary_domain !=null&&var.new_subdomain !=""?1:0
zone_id =var.secondary_hosted_zone_id
name =var.new_subdomain
type ="CNAME"
ttl ="60"
records =["${var.new_subdomain}.${var.secondary_domain}"]
allow_overwrite =true}