diff --git a/main.tf b/main.tf index e9a814df..90cfe27a 100644 --- a/main.tf +++ b/main.tf @@ -30,6 +30,7 @@ module "cluster_lb" { rg_name = "${module.common.rg_name}" location = "${module.common.rg_location}" resource_prefix = "${var.resource_prefix}" + hostname = "${var.hostname}" dns = { domain = "${var.domain}" diff --git a/modules/cluster_lb/dns.tf b/modules/cluster_lb/dns.tf index 0ab4567e..08bd3939 100644 --- a/modules/cluster_lb/dns.tf +++ b/modules/cluster_lb/dns.tf @@ -12,7 +12,7 @@ resource "azurerm_dns_a_record" "api" { } resource "azurerm_dns_a_record" "application" { - name = "${local.prefix}" + name = "${local.frontened_hostname}" zone_name = "${data.azurerm_dns_zone.selected.name}" resource_group_name = "${var.dns["rg_name"]}" ttl = "${var.dns["ttl"]}" diff --git a/modules/cluster_lb/variables.tf b/modules/cluster_lb/variables.tf index 14b131d0..346c3f03 100644 --- a/modules/cluster_lb/variables.tf +++ b/modules/cluster_lb/variables.tf @@ -41,11 +41,17 @@ variable "lb_probe_unhealthy_threshold" { description = "The amount of unhealthy checks before marking a node unhealthy." } +variable "hostname" { + default = "" + description = "hostname for loadbalancer front end to use" +} + # ============================================================ MISC # LB resource names locals { - prefix = "${var.resource_prefix}-${var.install_id}" - frontend = "${local.prefix}-fe" + prefix = "${var.resource_prefix}-${var.install_id}" + frontend = "${local.prefix}-fe" + frontened_hostname = "${var.hostname != "" ? var.hostname : local.prefix }" } diff --git a/variables.tf b/variables.tf index 9e124b11..55fac0b2 100644 --- a/variables.tf +++ b/variables.tf @@ -120,6 +120,11 @@ variable "encryption_password" { default = "" } +variable "hostname" { + description = "Hostname for loadbalancer frontend to use, otherwise will default to 'tfe-$install_id.domain.com'" + default = "" +} + variable "http_proxy_url" { type = "string" description = "HTTP(S) Proxy URL"