Skip to content

Commit

Permalink
Fix DNS E2E test + add one to net-lb-app-int-cross-region (#1993)
Browse files Browse the repository at this point in the history
* Fix DNS E2E test + add one to net-lb-app-int-cross-region

* Update README.md

* Fix inventory for tests

* Fix tests

* Fix number of resources

---------

Co-authored-by: Julio Castillo <[email protected]>
  • Loading branch information
wiktorn and juliocc authored Jan 23, 2024
1 parent 070584a commit 277777d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 47 deletions.
29 changes: 12 additions & 17 deletions modules/dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,16 @@ module "private-dns" {
}
"A geo2" = {
geo_routing = [
{ location = "europe-west1", health_checked_targets = [
{ location = var.region, health_checked_targets = [
{
load_balancer_type = "globalL7ilb",
ip_address = "10.10.2.3",
port = "80",
ip_protocol = "tcp",
load_balancer_type = "globalL7ilb"
ip_address = module.net-lb-app-int-cross-region.addresses[var.region]
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 = "10.10.3.3",
port = "80",
ip_protocol = "tcp",
network_url = var.vpc.self_link
project = var.project_id
}
] },
] }
]
}
"A wrr" = {
Expand All @@ -122,7 +112,7 @@ module "private-dns" {
}
}
}
# tftest modules=1 resources=5 inventory=routing-policies.yaml e2e
# tftest modules=4 resources=12 fixtures=fixtures/net-lb-app-int-cross-region.tf,fixtures/compute-mig.tf inventory=routing-policies.yaml e2e
```

### Reverse Lookup Zone
Expand Down Expand Up @@ -184,4 +174,9 @@ module "public-dns" {
| [name](outputs.tf#L32) | The DNS zone name. | |
| [name_servers](outputs.tf#L37) | The DNS zone name servers. | |
| [zone](outputs.tf#L42) | DNS zone resource. | |

## Fixtures

- [compute-mig.tf](../../tests/fixtures/compute-mig.tf)
- [net-lb-app-int-cross-region.tf](../../tests/fixtures/net-lb-app-int-cross-region.tf)
<!-- END TFDOC -->
14 changes: 8 additions & 6 deletions modules/net-lb-app-int-cross-region/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Due to the complexity of the underlying resources, changes to the configuration
- [Files](#files)
- [Variables](#variables)
- [Outputs](#outputs)
- [Fixtures](#fixtures)
<!-- END TOC -->

### Minimal Example
Expand All @@ -36,21 +37,18 @@ module "ilb-l7" {
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig-ew1"
}, {
group = "projects/myprj/zones/europe-west2-a/instanceGroups/my-ig-ew4"
group = module.compute-mig.group_manager.instance_group
}]
}
}
vpc_config = {
network = var.vpc.self_link
subnetworks = {
europe-west1 = var.subnet1.self_link
europe-west4 = var.subnet2.self_link
(var.region) = var.subnet.self_link
}
}
}
# tftest modules=1 resources=6
# tftest modules=3 resources=7 fixtures=fixtures/compute-mig.tf e2e
```

An HTTPS ILB needs a few additional fields:
Expand Down Expand Up @@ -774,4 +772,8 @@ module "ilb-l7" {
| [neg_ids](outputs.tf#L61) | Autogenerated network endpoint group ids. | |
| [psc_neg_ids](outputs.tf#L68) | Autogenerated PSC network endpoint group ids. | |
| [regional_neg_ids](outputs.tf#L75) | Autogenerated regional network endpoint group ids. | |

## Fixtures

- [compute-mig.tf](../../tests/fixtures/compute-mig.tf)
<!-- END TFDOC -->
34 changes: 34 additions & 0 deletions tests/fixtures/net-lb-app-int-cross-region.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# requires fixtures/fixtures/compute-mig.tf

module "net-lb-app-int-cross-region" {
source = "./fabric/modules/net-lb-app-int-cross-region"
name = "ilb-test"
project_id = var.project_id
backend_service_configs = {
default = {
backends = [{
group = module.compute-mig.group_manager.instance_group
}]
}
}
vpc_config = {
network = var.vpc.self_link
subnetworks = {
(var.region) = var.subnet.self_link
}
}
}
28 changes: 4 additions & 24 deletions tests/modules/dns/examples/routing-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,8 @@ values:
routing_policy:
- enable_geo_fencing: null
geo:
- health_checked_targets:
- internal_load_balancers:
- ip_address: 10.10.2.3
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: 10.10.3.3
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
- location: europe-west8
rrdatas: null
primary_backup: []
wrr: []
rrdatas: null
Expand Down Expand Up @@ -128,5 +108,5 @@ values:
counts:
google_dns_managed_zone: 1
google_dns_record_set: 4
modules: 1
resources: 5
modules: 4
resources: 12

0 comments on commit 277777d

Please sign in to comment.