diff --git a/files/cloud_init.cfg.tftpl b/files/cloud_init.cfg.tftpl index 58bff06..20b47d3 100644 --- a/files/cloud_init.cfg.tftpl +++ b/files/cloud_init.cfg.tftpl @@ -49,3 +49,9 @@ fs_setup: mounts: - ["data.1", "/mnt/data"] %{ endif } +%{ if fixed_dns != "" } +manage_resolv_conf: true +resolv_conf: + nameservers: + - "${fixed_dns}" +%{ endif } diff --git a/main.tf b/main.tf index 6383eae..25f9f57 100644 --- a/main.tf +++ b/main.tf @@ -15,6 +15,7 @@ locals { host_cert = trimspace(null_resource.cert.triggers["cert"]), private_key = tls_private_key.debian.private_key_openssh, data_disk = var.data_disk != null + fixed_dns = var.fixed_dns }) cloudinit_network_config = templatefile("${path.module}/files/network_config.cfg.tftpl", { fixed_address = var.fixed_address diff --git a/variables.tf b/variables.tf index 7fe7cbb..3cf88de 100644 --- a/variables.tf +++ b/variables.tf @@ -74,3 +74,8 @@ variable "ansible_command" { type = string default = "true" } + +variable "fixed_dns" { + type = string + default = "" +}