From c13a192755ae394111980ea2f3c23dac1e7ff19d Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Fri, 5 Jan 2024 16:02:12 +0100 Subject: [PATCH] Use zones b and c for MIG fixture (#1961) --- modules/net-lb-app-ext/README.md | 72 +++++++++---------- .../{compute-mig-ab.tf => compute-mig-bc.tf} | 36 +++++----- .../examples/complex-example.yaml | 38 +++++----- 3 files changed, 73 insertions(+), 73 deletions(-) rename tests/fixtures/{compute-mig-ab.tf => compute-mig-bc.tf} (91%) diff --git a/modules/net-lb-app-ext/README.md b/modules/net-lb-app-ext/README.md index ff5159268..bb0d7963c 100644 --- a/modules/net-lb-app-ext/README.md +++ b/modules/net-lb-app-ext/README.md @@ -46,13 +46,13 @@ module "glb-0" { backend_service_configs = { default = { backends = [ - { backend = module.compute-mig-a.group.id }, { backend = module.compute-mig-b.group.id }, + { backend = module.compute-mig-c.group.id }, ] } } } -# tftest modules=3 resources=9 fixtures=fixtures/compute-mig-ab.tf inventory=minimal-http.yaml e2e +# tftest modules=3 resources=9 fixtures=fixtures/compute-mig-bc.tf inventory=minimal-http.yaml e2e ``` ### Minimal HTTPS examples @@ -69,8 +69,8 @@ module "glb-0" { backend_service_configs = { default = { backends = [ - { backend = module.compute-mig-a.group.id }, { backend = module.compute-mig-b.group.id }, + { backend = module.compute-mig-c.group.id }, ] protocol = "HTTP" } @@ -84,7 +84,7 @@ module "glb-0" { } } } -# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-ab.tf inventory=http-backends.yaml e2e +# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-bc.tf inventory=http-backends.yaml e2e ``` #### HTTPS backends @@ -99,8 +99,8 @@ module "glb-0" { backend_service_configs = { default = { backends = [ - { backend = module.compute-mig-a.group.id }, { backend = module.compute-mig-b.group.id }, + { backend = module.compute-mig-c.group.id }, ] protocol = "HTTPS" } @@ -121,7 +121,7 @@ module "glb-0" { } } } -# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-ab.tf inventory=https-backends.yaml e2e +# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-bc.tf inventory=https-backends.yaml e2e ``` #### HTTP to HTTPS redirect @@ -180,7 +180,7 @@ module "glb-test-0" { } } -# tftest modules=5 resources=14 fixtures=fixtures/compute-mig-ab.tf inventory=http-https-redirect.yaml e2e +# tftest modules=5 resources=14 fixtures=fixtures/compute-mig-bc.tf inventory=http-https-redirect.yaml e2e ``` ### Classic vs Non-classic @@ -196,13 +196,13 @@ module "glb-0" { backend_service_configs = { default = { backends = [ - { backend = module.compute-mig-a.group.id }, { backend = module.compute-mig-b.group.id }, + { backend = module.compute-mig-c.group.id }, ] } } } -# tftest modules=3 resources=9 fixtures=fixtures/compute-mig-ab.tf inventory=classic-vs-non-classic.yaml e2e +# tftest modules=3 resources=9 fixtures=fixtures/compute-mig-bc.tf inventory=classic-vs-non-classic.yaml e2e ``` ### Health Checks @@ -221,7 +221,7 @@ module "glb-0" { backend_service_configs = { default = { backends = [{ - backend = module.compute-mig-a.group.id + backend = module.compute-mig-b.group.id }] # no need to reference the hc explicitly when using the `default` key # health_checks = ["default"] @@ -233,7 +233,7 @@ module "glb-0" { } } } -# tftest modules=3 resources=9 fixtures=fixtures/compute-mig-ab.tf inventory=health-check-1.yaml e2e +# tftest modules=3 resources=9 fixtures=fixtures/compute-mig-bc.tf inventory=health-check-1.yaml e2e ``` To leverage existing health checks without having the module create them, simply pass their self links to backend services and set the `health_check_configs` variable to an empty map: @@ -253,7 +253,7 @@ module "glb-0" { } health_check_configs = {} } -# tftest modules=3 resources=8 fixtures=fixtures/compute-mig-ab.tf inventory=health-check-2.yaml +# tftest modules=3 resources=8 fixtures=fixtures/compute-mig-bc.tf inventory=health-check-2.yaml ``` ### Backend Types and Management @@ -284,7 +284,7 @@ module "glb-0" { } } } -# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-ab.tf inventory=instance-groups.yaml e2e +# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-bc.tf inventory=instance-groups.yaml e2e ``` #### Managed Instance Groups @@ -440,7 +440,7 @@ module "glb-0" { } } } -# tftest modules=3 resources=11 fixtures=fixtures/compute-mig-ab.tf inventory=zonal-neg-creation.yaml e2e +# tftest modules=3 resources=11 fixtures=fixtures/compute-mig-bc.tf inventory=zonal-neg-creation.yaml e2e ``` #### Hybrid NEG creation @@ -636,12 +636,12 @@ module "glb-0" { backend_service_configs = { default = { backends = [{ - backend = module.compute-mig-a.group.id + backend = module.compute-mig-b.group.id }] } other = { backends = [{ - backend = module.compute-mig-b.group.id + backend = module.compute-mig-c.group.id }] } } @@ -663,7 +663,7 @@ module "glb-0" { } } -# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-ab.tf inventory=url-map.yaml e2e +# tftest modules=3 resources=10 fixtures=fixtures/compute-mig-bc.tf inventory=url-map.yaml e2e ``` ### SSL Certificates @@ -699,8 +699,8 @@ module "glb-0" { backend_service_configs = { default = { backends = [ - { backend = module.compute-mig-a.group.id }, { backend = module.compute-mig-b.group.id }, + { backend = module.compute-mig-c.group.id }, ] protocol = "HTTP" } @@ -716,7 +716,7 @@ module "glb-0" { } } } -# tftest modules=3 resources=12 fixtures=fixtures/compute-mig-ab.tf inventory=ssl-certificates.yaml e2e +# tftest modules=3 resources=12 fixtures=fixtures/compute-mig-bc.tf inventory=ssl-certificates.yaml e2e ``` ### Complex example @@ -736,14 +736,14 @@ module "glb-0" { backend_service_configs = { default = { backends = [ - { backend = "ew4-a" }, - { backend = "ew4-b" }, + { backend = "group-zone-b" }, + { backend = "group-zone-c" }, ] } neg-gce-0 = { backends = [{ balancing_mode = "RATE" - backend = "neg-ew4-b" + backend = "neg-zone-c" max_rate = { per_endpoint = 10 } }] } @@ -758,20 +758,20 @@ module "glb-0" { } } group_configs = { - ew4-a = { - zone = "${var.region}-a" - instances = [ - module.compute-mig-a.id - ] - named_ports = { http = 80 } - } - ew4-b = { + group-zone-b = { zone = "${var.region}-b" instances = [ module.compute-mig-b.id ] named_ports = { http = 80 } } + group-zone-c = { + zone = "${var.region}-c" + instances = [ + module.compute-mig-c.id + ] + named_ports = { http = 80 } + } } health_check_configs = { default = { @@ -787,15 +787,15 @@ module "glb-0" { } } neg_configs = { - neg-ew4-b = { + neg-zone-c = { gce = { network = var.vpc.self_link subnetwork = var.subnet.self_link - zone = "${var.region}-b" + zone = "${var.region}-c" endpoints = { e-0 = { - instance = "my-ig-b" - ip_address = module.compute-mig-b.internal_ip + instance = "my-ig-c" + ip_address = module.compute-mig-c.internal_ip port = 80 } } @@ -849,7 +849,7 @@ module "glb-0" { } } } -# tftest modules=3 resources=19 fixtures=fixtures/compute-mig-ab.tf inventory=complex-example.yaml e2e +# tftest modules=3 resources=19 fixtures=fixtures/compute-mig-bc.tf inventory=complex-example.yaml e2e ``` @@ -911,5 +911,5 @@ module "glb-0" { ## Fixtures -- [compute-mig-ab.tf](../../tests/fixtures/compute-mig-ab.tf) +- [compute-mig-bc.tf](../../tests/fixtures/compute-mig-bc.tf) diff --git a/tests/fixtures/compute-mig-ab.tf b/tests/fixtures/compute-mig-bc.tf similarity index 91% rename from tests/fixtures/compute-mig-ab.tf rename to tests/fixtures/compute-mig-bc.tf index f287cad2e..fbf8f3112 100644 --- a/tests/fixtures/compute-mig-ab.tf +++ b/tests/fixtures/compute-mig-bc.tf @@ -1,4 +1,4 @@ -# Copyright 2023 Google LLC +# 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. @@ -13,23 +13,6 @@ # limitations under the License. -module "compute-mig-a" { - source = "./fabric/modules/compute-vm" - project_id = var.project_id - zone = "${var.region}-a" - name = "my-ig-a" - network_interfaces = [{ - network = var.vpc.self_link - subnetwork = var.subnet.self_link - }] - boot_disk = { - initialize_params = { - image = "cos-cloud/cos-stable" - } - } - group = { named_ports = {} } -} - module "compute-mig-b" { source = "./fabric/modules/compute-vm" project_id = var.project_id @@ -46,3 +29,20 @@ module "compute-mig-b" { } group = { named_ports = {} } } + +module "compute-mig-c" { + source = "./fabric/modules/compute-vm" + project_id = var.project_id + zone = "${var.region}-c" + name = "my-ig-c" + network_interfaces = [{ + network = var.vpc.self_link + subnetwork = var.subnet.self_link + }] + boot_disk = { + initialize_params = { + image = "cos-cloud/cos-stable" + } + } + group = { named_ports = {} } +} diff --git a/tests/modules/net_lb_app_ext/examples/complex-example.yaml b/tests/modules/net_lb_app_ext/examples/complex-example.yaml index dc0aa07ad..4ab33a974 100644 --- a/tests/modules/net_lb_app_ext/examples/complex-example.yaml +++ b/tests/modules/net_lb_app_ext/examples/complex-example.yaml @@ -1,4 +1,4 @@ -# Copyright 2023 Google LLC +# 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. @@ -167,31 +167,31 @@ values: timeout_sec: 5 timeouts: null unhealthy_threshold: 2 - module.glb-0.google_compute_instance_group.default["ew4-a"]: + module.glb-0.google_compute_instance_group.default["group-zone-b"]: description: Terraform managed. - name: glb-test-0-ew4-a - named_port: - - name: http - port: 80 - project: project-id - timeouts: null - zone: europe-west8-a - module.glb-0.google_compute_instance_group.default["ew4-b"]: - description: Terraform managed. - name: glb-test-0-ew4-b + name: glb-test-0-group-zone-b named_port: - name: http port: 80 project: project-id timeouts: null zone: europe-west8-b - module.glb-0.google_compute_network_endpoint.default["neg-ew4-b-e-0"]: - instance: my-ig-b - network_endpoint_group: glb-test-0-neg-ew4-b + module.glb-0.google_compute_instance_group.default["group-zone-c"]: + description: Terraform managed. + name: glb-test-0-group-zone-c + named_port: + - name: http + port: 80 + project: project-id + timeouts: null + zone: europe-west8-c + module.glb-0.google_compute_network_endpoint.default["neg-zone-c-e-0"]: + instance: my-ig-c + network_endpoint_group: glb-test-0-neg-zone-c port: 80 project: project-id timeouts: null - zone: europe-west8-b + zone: europe-west8-c module.glb-0.google_compute_network_endpoint.default["neg-hello-e-0"]: instance: null ip_address: 192.168.0.3 @@ -200,16 +200,16 @@ values: project: project-id timeouts: null zone: europe-west8-b - module.glb-0.google_compute_network_endpoint_group.default["neg-ew4-b"]: + module.glb-0.google_compute_network_endpoint_group.default["neg-zone-c"]: default_port: null description: Terraform managed. - name: glb-test-0-neg-ew4-b + name: glb-test-0-neg-zone-c network: projects/xxx/global/networks/aaa network_endpoint_type: GCE_VM_IP_PORT project: project-id subnetwork: subnet_self_link timeouts: null - zone: europe-west8-b + zone: europe-west8-c module.glb-0.google_compute_network_endpoint_group.default["neg-hello"]: default_port: null description: Terraform managed.