diff --git a/terraform/modules/hcloud_instance/main.tf b/terraform/modules/hcloud_instance/main.tf index f2de273961ee52625b1068a9066e9e5e4a1ecc04..8e75000a19b7fc2fcb510b1098d8cf2319eb70c8 100644 --- a/terraform/modules/hcloud_instance/main.tf +++ b/terraform/modules/hcloud_instance/main.tf @@ -25,7 +25,7 @@ resource "cloudflare_record" "dns-a" { } resource "cloudflare_record" "dns-aaaa" { - count = var.instance_count + count = var.enable_IPv6 == true ? var.instance_count : 0 zone_id = var.dns_zone_id name = element(hcloud_server.server.*.name, count.index) value = "${element(hcloud_server.server.*.ipv6_address, count.index)}1" @@ -41,7 +41,7 @@ resource "hcloud_rdns" "dns-ptr-ipv4" { } resource "hcloud_rdns" "dns-ptr-ipv6" { - count = var.instance_count + count = var.enable_IPv6 == true ? var.instance_count : 0 server_id = element(hcloud_server.server.*.id, count.index) ip_address = "${element(hcloud_server.server.*.ipv6_address, count.index)}1" dns_ptr = element(hcloud_server.server.*.name, count.index) diff --git a/terraform/modules/hcloud_instance/variables.tf b/terraform/modules/hcloud_instance/variables.tf index 9e6cf71301722e7a1bcb8256465350e7a3e6b685..138ea22b2a6bb22d34657f2bd14c06c7fc8551c3 100644 --- a/terraform/modules/hcloud_instance/variables.tf +++ b/terraform/modules/hcloud_instance/variables.tf @@ -94,3 +94,9 @@ variable "subnet" { description = "Id of the additional internal network" default = null } + +variable "enable_IPv6" { + type = bool + description = "Enable or disable setting up IPv6" + default = true +}