Skip to content

Commit

Permalink
feat: allow setting routing path for target_name_server_addresses (#27
Browse files Browse the repository at this point in the history
)

BREAKING CHANGE: `target_name_server_addresses` is now a list of objects, allowing setting `forwarding_path` for each address.
  • Loading branch information
vktr-brlv authored Jun 22, 2021
1 parent 7c9cd40 commit 53955cb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. | <pre>list(object({<br> name = string<br> type = string<br> ttl = number<br> records = list(string)<br> }))</pre> | `[]` | 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 |

Expand Down
11 changes: 10 additions & 1 deletion examples/forwarding-zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
2 changes: 1 addition & 1 deletion examples/forwarding-zone/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 53955cb

Please sign in to comment.