add support for custom description in net-address (#1499)

This commit is contained in:
simonebruzzechesse 2023-07-10 13:04:54 +02:00 committed by GitHub
parent 0b224a7f55
commit 973a8594b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 15 deletions

View File

@ -83,12 +83,12 @@ module "addresses" {
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [project_id](variables.tf#L54) | Project where the addresses will be created. | <code>string</code> | ✓ | |
| [project_id](variables.tf#L55) | Project where the addresses will be created. | <code>string</code> | ✓ | |
| [external_addresses](variables.tf#L17) | Map of external address regions, keyed by name. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> |
| [global_addresses](variables.tf#L29) | List of global addresses to create. | <code>list&#40;string&#41;</code> | | <code>&#91;&#93;</code> |
| [internal_addresses](variables.tf#L35) | Map of internal addresses to create, keyed by name. | <code title="map&#40;object&#40;&#123;&#10; region &#61; string&#10; subnetwork &#61; string&#10; address &#61; optional&#40;string&#41;&#10; labels &#61; optional&#40;map&#40;string&#41;&#41;&#10; purpose &#61; optional&#40;string&#41;&#10; tier &#61; optional&#40;string&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [psa_addresses](variables.tf#L59) | Map of internal addresses used for Private Service Access. | <code title="map&#40;object&#40;&#123;&#10; address &#61; string&#10; network &#61; string&#10; prefix_length &#61; number&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [psc_addresses](variables.tf#L69) | Map of internal addresses used for Private Service Connect. | <code title="map&#40;object&#40;&#123;&#10; address &#61; string&#10; network &#61; string&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [internal_addresses](variables.tf#L35) | Map of internal addresses to create, keyed by name. | <code title="map&#40;object&#40;&#123;&#10; region &#61; string&#10; subnetwork &#61; string&#10; address &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform managed.&#34;&#41;&#10; labels &#61; optional&#40;map&#40;string&#41;&#41;&#10; purpose &#61; optional&#40;string&#41;&#10; tier &#61; optional&#40;string&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [psa_addresses](variables.tf#L60) | Map of internal addresses used for Private Service Access. | <code title="map&#40;object&#40;&#123;&#10; address &#61; string&#10; network &#61; string&#10; description &#61; optional&#40;string, &#34;Terraform managed.&#34;&#41;&#10; prefix_length &#61; number&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [psc_addresses](variables.tf#L71) | Map of internal addresses used for Private Service Connect. | <code title="map&#40;object&#40;&#123;&#10; address &#61; string&#10; network &#61; string&#10; description &#61; optional&#40;string, &#34;Terraform managed.&#34;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
## Outputs

View File

@ -35,7 +35,7 @@ resource "google_compute_address" "internal" {
for_each = var.internal_addresses
project = var.project_id
name = each.key
description = "Terraform managed."
description = each.value.description
address_type = "INTERNAL"
region = each.value.region
subnetwork = each.value.subnetwork
@ -49,7 +49,7 @@ resource "google_compute_global_address" "psc" {
for_each = var.psc_addresses
project = var.project_id
name = each.key
description = "Terraform managed."
description = each.value.description
address = try(each.value.address, null)
address_type = "INTERNAL"
network = each.value.network
@ -61,7 +61,7 @@ resource "google_compute_global_address" "psa" {
for_each = var.psa_addresses
project = var.project_id
name = each.key
description = "Terraform managed."
description = each.value.description
address = each.value.address
address_type = "INTERNAL"
network = each.value.network

View File

@ -35,12 +35,13 @@ variable "global_addresses" {
variable "internal_addresses" {
description = "Map of internal addresses to create, keyed by name."
type = map(object({
region = string
subnetwork = string
address = optional(string)
labels = optional(map(string))
purpose = optional(string)
tier = optional(string)
region = string
subnetwork = string
address = optional(string)
description = optional(string, "Terraform managed.")
labels = optional(map(string))
purpose = optional(string)
tier = optional(string)
}))
default = {}
}
@ -61,6 +62,7 @@ variable "psa_addresses" {
type = map(object({
address = string
network = string
description = optional(string, "Terraform managed.")
prefix_length = number
}))
default = {}
@ -69,8 +71,9 @@ variable "psa_addresses" {
variable "psc_addresses" {
description = "Map of internal addresses used for Private Service Connect."
type = map(object({
address = string
network = string
address = string
network = string
description = optional(string, "Terraform managed.")
}))
default = {}
}