From 53955cbbe10ac5e499cd59cc1574c7bf05880eeb Mon Sep 17 00:00:00 2001 From: Viktor Berlov Date: Tue, 22 Jun 2021 20:19:00 +0300 Subject: [PATCH] feat: allow setting routing path for `target_name_server_addresses` (#27) BREAKING CHANGE: `target_name_server_addresses` is now a list of objects, allowing setting `forwarding_path` for each address. --- README.md | 2 +- examples/forwarding-zone/main.tf | 11 ++++++++++- examples/forwarding-zone/variables.tf | 2 +- main.tf | 3 ++- variables.tf | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3c8a5d3..ad813dd 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Functional examples are included in the [examples](./examples/) directory. | private\_visibility\_config\_networks | List of VPC self links that can see this zone. | `list(string)` | `[]` | no | | project\_id | Project id for the zone. | `string` | n/a | yes | | recordsets | List of DNS record objects to manage, in the standard terraform dns structure. |
list(object({
name = string
type = string
ttl = number
records = list(string)
}))
| `[]` | no | -| target\_name\_server\_addresses | List of target name servers for forwarding zone. | `list(string)` | `[]` | no | +| target\_name\_server\_addresses | List of target name servers for forwarding zone. | `list(map(any))` | `[]` | no | | target\_network | Peering network. | `string` | `""` | no | | type | Type of zone to create, valid values are 'public', 'private', 'forwarding', 'peering'. | `string` | `"private"` | no | diff --git a/examples/forwarding-zone/main.tf b/examples/forwarding-zone/main.tf index 1e19b0c..8da2d86 100644 --- a/examples/forwarding-zone/main.tf +++ b/examples/forwarding-zone/main.tf @@ -23,5 +23,14 @@ module "dns-forwarding-zone" { labels = var.labels private_visibility_config_networks = [var.network_self_link] - target_name_server_addresses = ["8.8.8.8", "8.8.4.4"] + target_name_server_addresses = [ + { + ipv4_address = "8.8.8.8", + forwarding_path = "default" + }, + { + ipv4_address = "8.8.4.4", + forwarding_path = "default" + } + ] } diff --git a/examples/forwarding-zone/variables.tf b/examples/forwarding-zone/variables.tf index c43c5c9..0e497dd 100644 --- a/examples/forwarding-zone/variables.tf +++ b/examples/forwarding-zone/variables.tf @@ -35,7 +35,7 @@ variable "domain" { } variable "labels" { - type = map + type = map(any) description = "A set of key/value label pairs to assign to this ManagedZone" default = { owner = "foo" diff --git a/main.tf b/main.tf index abd03b6..cf4eed1 100644 --- a/main.tf +++ b/main.tf @@ -67,7 +67,8 @@ resource "google_dns_managed_zone" "forwarding" { dynamic "target_name_servers" { for_each = var.target_name_server_addresses content { - ipv4_address = target_name_servers.value + ipv4_address = target_name_servers.value.ipv4_address + forwarding_path = target_name_servers.value.forwarding_path } } } diff --git a/variables.tf b/variables.tf index f3fdc29..fffaa7a 100644 --- a/variables.tf +++ b/variables.tf @@ -42,7 +42,7 @@ variable "project_id" { variable "target_name_server_addresses" { description = "List of target name servers for forwarding zone." default = [] - type = list(string) + type = list(map(any)) } variable "target_network" {