From e900e9c9517fad45dd00ae36c183a40f2278fa33 Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Thu, 8 Jun 2023 14:00:10 +0200 Subject: [PATCH] Make internal/external addresses optional in compute-vm Fixes 1431 --- blueprints/data-solutions/sqlserver-alwayson/instances.tf | 4 +--- fast/stages/2-networking-e-nva-bgp/nva.tf | 2 -- modules/compute-vm/README.md | 6 +++--- modules/compute-vm/variables.tf | 6 +++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/blueprints/data-solutions/sqlserver-alwayson/instances.tf b/blueprints/data-solutions/sqlserver-alwayson/instances.tf index 89f39a6118..ab9f121718 100644 --- a/blueprints/data-solutions/sqlserver-alwayson/instances.tf +++ b/blueprints/data-solutions/sqlserver-alwayson/instances.tf @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,6 @@ module "nodes" { nat = false addresses = { internal = module.ip-addresses.internal_addresses[each.value].address - external = null } }] @@ -122,7 +121,6 @@ module "witness" { nat = false addresses = { internal = module.ip-addresses.internal_addresses[each.value].address - external = null } }] diff --git a/fast/stages/2-networking-e-nva-bgp/nva.tf b/fast/stages/2-networking-e-nva-bgp/nva.tf index baf6018a53..66ede6fd99 100644 --- a/fast/stages/2-networking-e-nva-bgp/nva.tf +++ b/fast/stages/2-networking-e-nva-bgp/nva.tf @@ -152,7 +152,6 @@ module "nva" { subnetwork = module.landing-untrusted-vpc.subnet_self_links["${each.value.region}/landing-untrusted-default-${each.value.shortname}"] nat = false addresses = { - external = null internal = google_compute_address.nva_static_ip_untrusted[each.key].address } }, @@ -161,7 +160,6 @@ module "nva" { subnetwork = module.landing-trusted-vpc.subnet_self_links["${each.value.region}/landing-trusted-default-${each.value.shortname}"] nat = false addresses = { - external = null internal = google_compute_address.nva_static_ip_trusted[each.key].address } } diff --git a/modules/compute-vm/README.md b/modules/compute-vm/README.md index c4badae306..1e22e8ddd7 100644 --- a/modules/compute-vm/README.md +++ b/modules/compute-vm/README.md @@ -215,7 +215,7 @@ module "vm-internal-ip" { network_interfaces = [{ network = var.vpc.self_link subnetwork = var.subnet.self_link - addresses = { external = null, internal = "10.0.0.2" } + addresses = { internal = "10.0.0.2" } }] } @@ -228,7 +228,7 @@ module "vm-external-ip" { network = var.vpc.self_link subnetwork = var.subnet.self_link nat = true - addresses = { external = "8.8.8.8", internal = null } + addresses = { external = "8.8.8.8" } }] } # tftest modules=2 resources=2 inventory=ips.yaml @@ -507,7 +507,7 @@ module "instance-group" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| | [name](variables.tf#L182) | Instance name. | string | ✓ | | -| [network_interfaces](variables.tf#L187) | Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed. | list(object({…})) | ✓ | | +| [network_interfaces](variables.tf#L187) | Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed. | list(object({…})) | ✓ | | | [project_id](variables.tf#L224) | Project id. | string | ✓ | | | [zone](variables.tf#L283) | Compute zone. | string | ✓ | | | [attached_disk_defaults](variables.tf#L17) | Defaults for attached disks options. | object({…}) | | {…} | diff --git a/modules/compute-vm/variables.tf b/modules/compute-vm/variables.tf index bda754388d..8ec1e7163d 100644 --- a/modules/compute-vm/variables.tf +++ b/modules/compute-vm/variables.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -191,8 +191,8 @@ variable "network_interfaces" { network = string subnetwork = string addresses = optional(object({ - internal = string - external = string + internal = optional(string) + external = optional(string) }), null) alias_ips = optional(map(string), {}) nic_type = optional(string)