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 | | 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> | | [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> | | [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> | | [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#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> | | [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#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> | | [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 ## Outputs

View File

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

View File

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