Merge pull request #1988 from apichick/dns-geo-health-checked-targets
Added health checked targets for geo routing policy in dns module
This commit is contained in:
commit
4a12a33e3c
|
@ -81,14 +81,37 @@ module "private-dns" {
|
||||||
}
|
}
|
||||||
recordsets = {
|
recordsets = {
|
||||||
"A regular" = { records = ["10.20.0.1"] }
|
"A regular" = { records = ["10.20.0.1"] }
|
||||||
"A geo" = {
|
"A geo1" = {
|
||||||
geo_routing = [
|
geo_routing = [
|
||||||
{ location = "europe-west1", records = ["10.0.0.1"] },
|
{ location = "europe-west1", records = ["10.0.0.1"] },
|
||||||
{ location = "europe-west2", records = ["10.0.0.2"] },
|
{ location = "europe-west2", records = ["10.0.0.2"] },
|
||||||
{ location = "europe-west3", records = ["10.0.0.3"] }
|
{ location = "europe-west3", records = ["10.0.0.3"] }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
"A geo2" = {
|
||||||
|
geo_routing = [
|
||||||
|
{ location = "europe-west1", health_checked_targets = [
|
||||||
|
{
|
||||||
|
load_balancer_type = "globalL7ilb",
|
||||||
|
ip_address = "gil7-forwarding-rule-a",
|
||||||
|
port = "80",
|
||||||
|
ip_protocol = "tcp",
|
||||||
|
network_url = var.vpc.self_link
|
||||||
|
project = var.project_id
|
||||||
|
}
|
||||||
|
] },
|
||||||
|
{ location = "europe-west2", health_checked_targets = [
|
||||||
|
{
|
||||||
|
load_balancer_type = "globalL7ilb",
|
||||||
|
ip_address = "gil7-forwarding-rule-b",
|
||||||
|
port = "80",
|
||||||
|
ip_protocol = "tcp",
|
||||||
|
network_url = var.vpc.self_link
|
||||||
|
project = var.project_id
|
||||||
|
}
|
||||||
|
] },
|
||||||
|
]
|
||||||
|
}
|
||||||
"A wrr" = {
|
"A wrr" = {
|
||||||
ttl = 600
|
ttl = 600
|
||||||
wrr_routing = [
|
wrr_routing = [
|
||||||
|
@ -99,7 +122,7 @@ module "private-dns" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=4 inventory=routing-policies.yaml e2e
|
# tftest modules=1 resources=5 inventory=routing-policies.yaml e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
### Reverse Lookup Zone
|
### Reverse Lookup Zone
|
||||||
|
@ -148,8 +171,8 @@ module "public-dns" {
|
||||||
| [project_id](variables.tf#L34) | Project id for the zone. | <code>string</code> | ✓ | |
|
| [project_id](variables.tf#L34) | Project id for the zone. | <code>string</code> | ✓ | |
|
||||||
| [description](variables.tf#L17) | Domain description. | <code>string</code> | | <code>"Terraform managed."</code> |
|
| [description](variables.tf#L17) | Domain description. | <code>string</code> | | <code>"Terraform managed."</code> |
|
||||||
| [iam](variables.tf#L23) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>null</code> |
|
| [iam](variables.tf#L23) | IAM bindings in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>null</code> |
|
||||||
| [recordsets](variables.tf#L39) | Map of DNS recordsets in \"type name\" => {ttl, [records]} format. | <code title="map(object({ ttl = optional(number, 300) records = optional(list(string)) geo_routing = optional(list(object({ location = string records = list(string) }))) wrr_routing = optional(list(object({ weight = number records = list(string) }))) }))">map(object({…}))</code> | | <code>{}</code> |
|
| [recordsets](variables.tf#L39) | Map of DNS recordsets in \"type name\" => {ttl, [records]} format. | <code title="map(object({ ttl = optional(number, 300) records = optional(list(string)) geo_routing = optional(list(object({ location = string records = optional(list(string)) health_checked_targets = optional(list(object({ load_balancer_type = string ip_address = string port = string ip_protocol = string network_url = string project = string region = optional(string) }))) }))) wrr_routing = optional(list(object({ weight = number records = list(string) }))) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||||
| [zone_config](variables.tf#L74) | DNS zone configuration. | <code title="object({ domain = string forwarding = optional(object({ forwarders = optional(map(string)) client_networks = list(string) })) peering = optional(object({ client_networks = list(string) peer_network = string })) public = optional(object({ dnssec_config = optional(object({ non_existence = optional(string, "nsec3") state = string key_signing_key = optional(object( { algorithm = string, key_length = number }), { algorithm = "rsasha256", key_length = 2048 } ) zone_signing_key = optional(object( { algorithm = string, key_length = number }), { algorithm = "rsasha256", key_length = 1024 } ) })) enable_logging = optional(bool, false) })) private = optional(object({ client_networks = list(string) service_directory_namespace = optional(string) })) })">object({…})</code> | | <code>null</code> |
|
| [zone_config](variables.tf#L83) | DNS zone configuration. | <code title="object({ domain = string forwarding = optional(object({ forwarders = optional(map(string)) client_networks = list(string) })) peering = optional(object({ client_networks = list(string) peer_network = string })) public = optional(object({ dnssec_config = optional(object({ non_existence = optional(string, "nsec3") state = string key_signing_key = optional(object( { algorithm = string, key_length = number }), { algorithm = "rsasha256", key_length = 2048 } ) zone_signing_key = optional(object( { algorithm = string, key_length = number }), { algorithm = "rsasha256", key_length = 1024 } ) })) enable_logging = optional(bool, false) })) private = optional(object({ client_networks = list(string) service_directory_namespace = optional(string) })) })">object({…})</code> | | <code>null</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,23 @@ resource "google_dns_record_set" "dns_record_set" {
|
||||||
content {
|
content {
|
||||||
location = geo.value.location
|
location = geo.value.location
|
||||||
rrdatas = geo.value.records
|
rrdatas = geo.value.records
|
||||||
|
dynamic "health_checked_targets" {
|
||||||
|
for_each = try(geo.value.health_checked_targets, null) == null ? [] : [""]
|
||||||
|
content {
|
||||||
|
dynamic "internal_load_balancers" {
|
||||||
|
for_each = geo.value.health_checked_targets
|
||||||
|
content {
|
||||||
|
load_balancer_type = internal_load_balancers.value.load_balancer_type
|
||||||
|
ip_address = internal_load_balancers.value.ip_address
|
||||||
|
port = internal_load_balancers.value.port
|
||||||
|
ip_protocol = internal_load_balancers.value.ip_protocol
|
||||||
|
network_url = internal_load_balancers.value.network_url
|
||||||
|
project = internal_load_balancers.value.project
|
||||||
|
region = internal_load_balancers.value.region
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dynamic "wrr" {
|
dynamic "wrr" {
|
||||||
|
|
|
@ -43,7 +43,16 @@ variable "recordsets" {
|
||||||
records = optional(list(string))
|
records = optional(list(string))
|
||||||
geo_routing = optional(list(object({
|
geo_routing = optional(list(object({
|
||||||
location = string
|
location = string
|
||||||
records = list(string)
|
records = optional(list(string))
|
||||||
|
health_checked_targets = optional(list(object({
|
||||||
|
load_balancer_type = string
|
||||||
|
ip_address = string
|
||||||
|
port = string
|
||||||
|
ip_protocol = string
|
||||||
|
network_url = string
|
||||||
|
project = string
|
||||||
|
region = optional(string)
|
||||||
|
})))
|
||||||
})))
|
})))
|
||||||
wrr_routing = optional(list(object({
|
wrr_routing = optional(list(object({
|
||||||
weight = number
|
weight = number
|
||||||
|
|
|
@ -14,12 +14,28 @@
|
||||||
|
|
||||||
values:
|
values:
|
||||||
module.private-dns.google_dns_managed_zone.dns_managed_zone[0]:
|
module.private-dns.google_dns_managed_zone.dns_managed_zone[0]:
|
||||||
|
cloud_logging_config:
|
||||||
|
- enable_logging: false
|
||||||
|
description: Terraform managed.
|
||||||
dns_name: test.example.
|
dns_name: test.example.
|
||||||
|
dnssec_config: []
|
||||||
|
force_destroy: false
|
||||||
|
forwarding_config: []
|
||||||
|
labels: null
|
||||||
name: test-example
|
name: test-example
|
||||||
|
peering_config: []
|
||||||
|
private_visibility_config:
|
||||||
|
- gke_clusters: []
|
||||||
|
networks:
|
||||||
|
- network_url: projects/xxx/global/networks/aaa
|
||||||
project: project-id
|
project: project-id
|
||||||
module.private-dns.google_dns_record_set.dns_record_set["A geo"]:
|
reverse_lookup: false
|
||||||
|
service_directory_config: []
|
||||||
|
timeouts: null
|
||||||
|
visibility: private
|
||||||
|
module.private-dns.google_dns_record_set.dns_record_set["A geo1"]:
|
||||||
managed_zone: test-example
|
managed_zone: test-example
|
||||||
name: geo.test.example.
|
name: geo1.test.example.
|
||||||
project: project-id
|
project: project-id
|
||||||
routing_policy:
|
routing_policy:
|
||||||
- enable_geo_fencing: null
|
- enable_geo_fencing: null
|
||||||
|
@ -41,6 +57,40 @@ values:
|
||||||
rrdatas: null
|
rrdatas: null
|
||||||
ttl: 300
|
ttl: 300
|
||||||
type: A
|
type: A
|
||||||
|
module.private-dns.google_dns_record_set.dns_record_set["A geo2"]:
|
||||||
|
managed_zone: test-example
|
||||||
|
name: geo2.test.example.
|
||||||
|
project: project-id
|
||||||
|
routing_policy:
|
||||||
|
- enable_geo_fencing: null
|
||||||
|
geo:
|
||||||
|
- health_checked_targets:
|
||||||
|
- internal_load_balancers:
|
||||||
|
- ip_address: gil7-forwarding-rule-a
|
||||||
|
ip_protocol: tcp
|
||||||
|
load_balancer_type: globalL7ilb
|
||||||
|
network_url: projects/xxx/global/networks/aaa
|
||||||
|
port: '80'
|
||||||
|
project: project-id
|
||||||
|
region: null
|
||||||
|
location: europe-west1
|
||||||
|
rrdatas: null
|
||||||
|
- health_checked_targets:
|
||||||
|
- internal_load_balancers:
|
||||||
|
- ip_address: gil7-forwarding-rule-b
|
||||||
|
ip_protocol: tcp
|
||||||
|
load_balancer_type: globalL7ilb
|
||||||
|
network_url: projects/xxx/global/networks/aaa
|
||||||
|
port: '80'
|
||||||
|
project: project-id
|
||||||
|
region: null
|
||||||
|
location: europe-west2
|
||||||
|
rrdatas: null
|
||||||
|
primary_backup: []
|
||||||
|
wrr: []
|
||||||
|
rrdatas: null
|
||||||
|
ttl: 300
|
||||||
|
type: A
|
||||||
module.private-dns.google_dns_record_set.dns_record_set["A regular"]:
|
module.private-dns.google_dns_record_set.dns_record_set["A regular"]:
|
||||||
managed_zone: test-example
|
managed_zone: test-example
|
||||||
name: regular.test.example.
|
name: regular.test.example.
|
||||||
|
@ -77,4 +127,6 @@ values:
|
||||||
|
|
||||||
counts:
|
counts:
|
||||||
google_dns_managed_zone: 1
|
google_dns_managed_zone: 1
|
||||||
google_dns_record_set: 3
|
google_dns_record_set: 4
|
||||||
|
modules: 1
|
||||||
|
resources: 5
|
Loading…
Reference in New Issue