Skip to content

Commit

Permalink
feat: add a subdomain for A records
Browse files Browse the repository at this point in the history
  • Loading branch information
raisedadead committed Jul 16, 2023
1 parent 6b03db4 commit 257cddc
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 51 deletions.
12 changes: 6 additions & 6 deletions terraform/ops-cluster-o11y/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ resource "linode_domain_record" "ops_o11y_leaders_dnsrecord__vlan" {
count = var.leader_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "ldr-${count.index + 1}.o11y"
name = "ldr-${count.index + 1}.o11y.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.ops_o11y_leaders_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -109,7 +109,7 @@ resource "linode_domain_record" "ops_o11y_leaders_dnsrecord__public" {
count = var.leader_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.ldr-${count.index + 1}.o11y"
name = "pub.ldr-${count.index + 1}.o11y.${var.network_subdomain}"
record_type = "A"
target = linode_instance.ops_o11y_leaders[count.index].ip_address
ttl_sec = 120
Expand All @@ -119,7 +119,7 @@ resource "linode_domain_record" "ops_o11y_leaders_dnsrecord__private" {
count = var.leader_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.ldr-${count.index + 1}.o11y"
name = "prv.ldr-${count.index + 1}.o11y.${var.network_subdomain}"
record_type = "A"
target = linode_instance.ops_o11y_leaders[count.index].private_ip_address
ttl_sec = 120
Expand Down Expand Up @@ -204,7 +204,7 @@ resource "linode_domain_record" "ops_o11y_workers_dnsrecord__vlan" {
count = var.worker_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "wkr-${count.index + 1}.o11y"
name = "wkr-${count.index + 1}.o11y.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.ops_o11y_workers_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -214,7 +214,7 @@ resource "linode_domain_record" "ops_o11y_workers_dnsrecord__public" {
count = var.worker_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.wkr-${count.index + 1}.o11y"
name = "pub.wkr-${count.index + 1}.o11y.${var.network_subdomain}"
record_type = "A"
target = linode_instance.ops_o11y_workers[count.index].ip_address
ttl_sec = 120
Expand All @@ -224,7 +224,7 @@ resource "linode_domain_record" "ops_o11y_workers_dnsrecord__private" {
count = var.worker_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.wkr-${count.index + 1}.o11y"
name = "prv.wkr-${count.index + 1}.o11y.${var.network_subdomain}"
record_type = "A"
target = linode_instance.ops_o11y_workers[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 6 additions & 0 deletions terraform/ops-cluster-o11y/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ variable "region" {
type = string
}

variable "network_subdomain" {
description = "The subdomain for the network."
type = string
sensitive = true
}

# variable "image_id" {
# description = "The ID for the Linode image to be used in provisioning the instances"
# default = "private/20789403"
Expand Down
4 changes: 2 additions & 2 deletions terraform/ops-test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ resource "linode_instance_config" "ops_test_config" {

resource "linode_domain_record" "ops_test_records" {
domain_id = data.linode_domain.ops_dns_domain.id
name = "test"
name = "test.${var.network_subdomain}"
record_type = "A"
target = linode_instance.ops_test.ip_address
ttl_sec = 120
}

resource "linode_domain_record" "ops_test_dnsrecord__public" {
domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.test"
name = "pub.test.${var.network_subdomain}"
record_type = "A"
target = linode_instance.ops_test.ip_address
ttl_sec = 120
Expand Down
6 changes: 6 additions & 0 deletions terraform/ops-test/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ variable "region" {
type = string
}

variable "network_subdomain" {
description = "The subdomain for the network."
type = string
sensitive = true
}

# variable "image_id" {
# description = "The ID for the Linode image to be used in provisioning the instances"
# default = "private/20789403"
Expand Down
12 changes: 6 additions & 6 deletions terraform/prd-cluster-publish/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ resource "linode_domain_record" "prd_publish_leaders_dnsrecord__vlan" {
count = var.leader_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "ldr-${count.index + 1}.publish.prd"
name = "ldr-${count.index + 1}.publish.prd.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.prd_publish_leaders_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -109,7 +109,7 @@ resource "linode_domain_record" "prd_publish_leaders_dnsrecord__public" {
count = var.leader_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.ldr-${count.index + 1}.publish.prd"
name = "pub.ldr-${count.index + 1}.publish.prd.${var.network_subdomain}"
record_type = "A"
target = linode_instance.prd_publish_leaders[count.index].ip_address
ttl_sec = 120
Expand All @@ -119,7 +119,7 @@ resource "linode_domain_record" "prd_publish_leaders_dnsrecord__private" {
count = var.leader_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.ldr-${count.index + 1}.publish.prd"
name = "prv.ldr-${count.index + 1}.publish.prd.${var.network_subdomain}"
record_type = "A"
target = linode_instance.prd_publish_leaders[count.index].private_ip_address
ttl_sec = 120
Expand Down Expand Up @@ -204,7 +204,7 @@ resource "linode_domain_record" "prd_publish_workers_dnsrecord__vlan" {
count = var.worker_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "wkr-${count.index + 1}.publish.prd"
name = "wkr-${count.index + 1}.publish.prd.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.prd_publish_workers_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -214,7 +214,7 @@ resource "linode_domain_record" "prd_publish_workers_dnsrecord__public" {
count = var.worker_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.wkr-${count.index + 1}.publish.prd"
name = "pub.wkr-${count.index + 1}.publish.prd.${var.network_subdomain}"
record_type = "A"
target = linode_instance.prd_publish_workers[count.index].ip_address
ttl_sec = 120
Expand All @@ -224,7 +224,7 @@ resource "linode_domain_record" "prd_publish_workers_dnsrecord__private" {
count = var.worker_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.wkr-${count.index + 1}.publish.prd"
name = "prv.wkr-${count.index + 1}.publish.prd.${var.network_subdomain}"
record_type = "A"
target = linode_instance.prd_publish_workers[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 6 additions & 0 deletions terraform/prd-cluster-publish/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ variable "region" {
type = string
}

variable "network_subdomain" {
description = "The subdomain for the network."
type = string
sensitive = true
}

# variable "image_id" {
# description = "The ID for the Linode image to be used in provisioning the instances"
# default = "private/20789403"
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-01-nginx.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_pxy_dnsrecord__vlan" {
count = local.pxy_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pxy-${count.index + 1}.oldeworld.stg"
name = "pxy-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_pxy_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_pxy_dnsrecord__public" {
count = local.pxy_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.pxy-${count.index + 1}.oldeworld.stg"
name = "pub.pxy-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_pxy[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_pxy_dnsrecord__private" {
count = local.pxy_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.pxy-${count.index + 1}.oldeworld.stg"
name = "prv.pxy-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_pxy[count.index].private_ip_address
ttl_sec = 120
Expand Down
2 changes: 1 addition & 1 deletion terraform/stg-cluster-oldeworld/next-02-nginx-origins.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ resource "linode_nodebalancer_node" "stg_oldeworld_nb_pxy_nodes__port_80" {

resource "linode_domain_record" "stg_oldeworld_nb_pxy_dnsrecord__public" {
domain_id = data.linode_domain.ops_dns_domain.id
name = "oldeworld.stg"
name = "oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = data.linode_nodebalancer.stg_oldeworld_nb_pxy.ipv4
ttl_sec = 120
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-11-client-eng.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_clteng_dnsrecord__vlan" {
count = local.clteng_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "clteng-${count.index + 1}.oldeworld.stg"
name = "clteng-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_clteng_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_clteng_dnsrecord__public" {
count = local.clteng_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.clteng-${count.index + 1}.oldeworld.stg"
name = "pub.clteng-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_clteng[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_clteng_dnsrecord__private" {
count = local.clteng_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.clteng-${count.index + 1}.oldeworld.stg"
name = "prv.clteng-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_clteng[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-12-client-chn.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_cltchn_dnsrecord__vlan" {
count = local.cltchn_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "cltchn-${count.index + 1}.oldeworld.stg"
name = "cltchn-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_cltchn_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_cltchn_dnsrecord__public" {
count = local.cltchn_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.cltchn-${count.index + 1}.oldeworld.stg"
name = "pub.cltchn-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltchn[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_cltchn_dnsrecord__private" {
count = local.cltchn_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.cltchn-${count.index + 1}.oldeworld.stg"
name = "prv.cltchn-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltchn[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-13-client-cnt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_cltcnt_dnsrecord__vlan" {
count = local.cltcnt_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "cltcnt-${count.index + 1}.oldeworld.stg"
name = "cltcnt-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_cltcnt_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_cltcnt_dnsrecord__public" {
count = local.cltcnt_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.cltcnt-${count.index + 1}.oldeworld.stg"
name = "pub.cltcnt-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltcnt[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_cltcnt_dnsrecord__private" {
count = local.cltcnt_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.cltcnt-${count.index + 1}.oldeworld.stg"
name = "prv.cltcnt-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltcnt[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-14-client-esp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_cltesp_dnsrecord__vlan" {
count = local.cltesp_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "cltesp-${count.index + 1}.oldeworld.stg"
name = "cltesp-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_cltesp_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_cltesp_dnsrecord__public" {
count = local.cltesp_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.cltesp-${count.index + 1}.oldeworld.stg"
name = "pub.cltesp-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltesp[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_cltesp_dnsrecord__private" {
count = local.cltesp_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.cltesp-${count.index + 1}.oldeworld.stg"
name = "prv.cltesp-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltesp[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-15-client-ger.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_cltger_dnsrecord__vlan" {
count = local.cltger_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "cltger-${count.index + 1}.oldeworld.stg"
name = "cltger-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_cltger_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_cltger_dnsrecord__public" {
count = local.cltger_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.cltger-${count.index + 1}.oldeworld.stg"
name = "pub.cltger-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltger[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_cltger_dnsrecord__private" {
count = local.cltger_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.cltger-${count.index + 1}.oldeworld.stg"
name = "prv.cltger-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltger[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-16-client-ita.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_cltita_dnsrecord__vlan" {
count = local.cltita_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "cltita-${count.index + 1}.oldeworld.stg"
name = "cltita-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_cltita_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_cltita_dnsrecord__public" {
count = local.cltita_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.cltita-${count.index + 1}.oldeworld.stg"
name = "pub.cltita-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltita[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_cltita_dnsrecord__private" {
count = local.cltita_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.cltita-${count.index + 1}.oldeworld.stg"
name = "prv.cltita-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltita[count.index].private_ip_address
ttl_sec = 120
Expand Down
6 changes: 3 additions & 3 deletions terraform/stg-cluster-oldeworld/next-17-client-jpn.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "linode_domain_record" "stg_oldeworld_cltjpn_dnsrecord__vlan" {
count = local.cltjpn_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "cltjpn-${count.index + 1}.oldeworld.stg"
name = "cltjpn-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = trimsuffix(linode_instance_config.stg_oldeworld_cltjpn_config[count.index].interface[1].ipam_address, "/24")
ttl_sec = 120
Expand All @@ -87,7 +87,7 @@ resource "linode_domain_record" "stg_oldeworld_cltjpn_dnsrecord__public" {
count = local.cltjpn_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "pub.cltjpn-${count.index + 1}.oldeworld.stg"
name = "pub.cltjpn-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltjpn[count.index].ip_address
ttl_sec = 120
Expand All @@ -97,7 +97,7 @@ resource "linode_domain_record" "stg_oldeworld_cltjpn_dnsrecord__private" {
count = local.cltjpn_node_count

domain_id = data.linode_domain.ops_dns_domain.id
name = "prv.cltjpn-${count.index + 1}.oldeworld.stg"
name = "prv.cltjpn-${count.index + 1}.oldeworld.stg.${var.network_subdomain}"
record_type = "A"
target = linode_instance.stg_oldeworld_cltjpn[count.index].private_ip_address
ttl_sec = 120
Expand Down
Loading

0 comments on commit 257cddc

Please sign in to comment.