From 50d8d4b8b84a08683cdbb44a9be41771b2b4107c Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Mon, 12 Jun 2023 10:21:25 +0200 Subject: [PATCH] Add subnets id output, expand net-address outputs --- modules/net-address/README.md | 8 ++++---- modules/net-address/outputs.tf | 28 ++++++---------------------- modules/net-vpc/README.md | 15 ++++++++------- modules/net-vpc/outputs.tf | 7 ++++++- 4 files changed, 24 insertions(+), 34 deletions(-) diff --git a/modules/net-address/README.md b/modules/net-address/README.md index 32b660146e..e8e34ff1b0 100644 --- a/modules/net-address/README.md +++ b/modules/net-address/README.md @@ -95,9 +95,9 @@ module "addresses" { | name | description | sensitive | |---|---|:---:| | [external_addresses](outputs.tf#L17) | Allocated external addresses. | | -| [global_addresses](outputs.tf#L28) | Allocated global external addresses. | | -| [internal_addresses](outputs.tf#L39) | Allocated internal addresses. | | -| [psa_addresses](outputs.tf#L50) | Allocated internal addresses for PSA endpoints. | | -| [psc_addresses](outputs.tf#L62) | Allocated internal addresses for PSC endpoints. | | +| [global_addresses](outputs.tf#L25) | Allocated global external addresses. | | +| [internal_addresses](outputs.tf#L33) | Allocated internal addresses. | | +| [psa_addresses](outputs.tf#L41) | Allocated internal addresses for PSA endpoints. | | +| [psc_addresses](outputs.tf#L49) | Allocated internal addresses for PSC endpoints. | | diff --git a/modules/net-address/outputs.tf b/modules/net-address/outputs.tf index da6912736b..e77a36b41e 100644 --- a/modules/net-address/outputs.tf +++ b/modules/net-address/outputs.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. @@ -18,10 +18,7 @@ output "external_addresses" { description = "Allocated external addresses." value = { for address in google_compute_address.external : - address.name => { - address = address.address - self_link = address.self_link - } + address.name => address } } @@ -29,10 +26,7 @@ output "global_addresses" { description = "Allocated global external addresses." value = { for address in google_compute_global_address.global : - address.name => { - address = address.address - self_link = address.self_link - } + address.name => address } } @@ -40,10 +34,7 @@ output "internal_addresses" { description = "Allocated internal addresses." value = { for address in google_compute_address.internal : - address.name => { - address = address.address - self_link = address.self_link - } + address.name => address } } @@ -51,11 +42,7 @@ output "psa_addresses" { description = "Allocated internal addresses for PSA endpoints." value = { for address in google_compute_global_address.psa : - address.name => { - address = address.address - prefix_length = address.prefix_length - self_link = address.self_link - } + address.name => address } } @@ -63,9 +50,6 @@ output "psc_addresses" { description = "Allocated internal addresses for PSC endpoints." value = { for address in google_compute_global_address.psc : - address.name => { - address = address.address - self_link = address.self_link - } + address.name => address } } diff --git a/modules/net-vpc/README.md b/modules/net-vpc/README.md index 45f4702730..ab7c3cc2b2 100644 --- a/modules/net-vpc/README.md +++ b/modules/net-vpc/README.md @@ -512,12 +512,13 @@ module "vpc" { | [network](outputs.tf#L46) | Network resource. | | | [project_id](outputs.tf#L58) | Project ID containing the network. Use this when you need to create resources *after* the VPC is fully set up (e.g. subnets created, shared VPC service projects attached, Private Service Networking configured). | | | [self_link](outputs.tf#L71) | Network self link. | | -| [subnet_ips](outputs.tf#L83) | Map of subnet address ranges keyed by name. | | -| [subnet_regions](outputs.tf#L90) | Map of subnet regions keyed by name. | | -| [subnet_secondary_ranges](outputs.tf#L97) | Map of subnet secondary ranges keyed by name. | | -| [subnet_self_links](outputs.tf#L108) | Map of subnet self links keyed by name. | | -| [subnets](outputs.tf#L113) | Subnet resources. | | -| [subnets_proxy_only](outputs.tf#L118) | L7 ILB or L7 Regional LB subnet resources. | | -| [subnets_psc](outputs.tf#L123) | Private Service Connect subnet resources. | | +| [subnet_ids](outputs.tf#L83) | Map of subnet IDs keyed by name. | | +| [subnet_ips](outputs.tf#L88) | Map of subnet address ranges keyed by name. | | +| [subnet_regions](outputs.tf#L95) | Map of subnet regions keyed by name. | | +| [subnet_secondary_ranges](outputs.tf#L102) | Map of subnet secondary ranges keyed by name. | | +| [subnet_self_links](outputs.tf#L113) | Map of subnet self links keyed by name. | | +| [subnets](outputs.tf#L118) | Subnet resources. | | +| [subnets_proxy_only](outputs.tf#L123) | L7 ILB or L7 Regional LB subnet resources. | | +| [subnets_psc](outputs.tf#L128) | Private Service Connect subnet resources. | | diff --git a/modules/net-vpc/outputs.tf b/modules/net-vpc/outputs.tf index 3359cee712..f9f5254f4c 100644 --- a/modules/net-vpc/outputs.tf +++ b/modules/net-vpc/outputs.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. @@ -80,6 +80,11 @@ output "self_link" { ] } +output "subnet_ids" { + description = "Map of subnet IDs keyed by name." + value = { for k, v in google_compute_subnetwork.subnetwork : k => v.id } +} + output "subnet_ips" { description = "Map of subnet address ranges keyed by name." value = {