net-address: allow users to optionally specify address names (#1795)
This commit is contained in:
parent
1ed48b556f
commit
f54b4f88b8
|
@ -106,13 +106,13 @@ module "addresses" {
|
|||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [project_id](variables.tf#L65) | Project where the addresses will be created. | <code>string</code> | ✓ | |
|
||||
| [external_addresses](variables.tf#L17) | Map of external addresses, keyed by name. | <code title="map(object({ region = string description = optional(string, "Terraform managed.") labels = optional(map(string), {}) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [global_addresses](variables.tf#L27) | List of global addresses to create. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [internal_addresses](variables.tf#L33) | Map of internal addresses to create, keyed by name. | <code title="map(object({ region = string subnetwork = string address = optional(string) description = optional(string, "Terraform managed.") labels = optional(map(string)) purpose = optional(string) tier = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [ipsec_interconnect_addresses](variables.tf#L47) | Map of internal addresses used for HPA VPN over Cloud Interconnect. | <code title="map(object({ region = string address = string network = string description = optional(string, "Terraform managed.") prefix_length = number }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psa_addresses](variables.tf#L70) | Map of internal addresses used for Private Service Access. | <code title="map(object({ address = string network = string description = optional(string, "Terraform managed.") prefix_length = number }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psc_addresses](variables.tf#L81) | Map of internal addresses used for Private Service Connect. | <code title="map(object({ address = string network = string description = optional(string, "Terraform managed.") }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [project_id](variables.tf#L68) | Project where the addresses will be created. | <code>string</code> | ✓ | |
|
||||
| [external_addresses](variables.tf#L17) | Map of external addresses, keyed by name. | <code title="map(object({ region = string description = optional(string, "Terraform managed.") labels = optional(map(string), {}) name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [global_addresses](variables.tf#L28) | List of global addresses to create. | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [internal_addresses](variables.tf#L34) | Map of internal addresses to create, keyed by name. | <code title="map(object({ region = string subnetwork = string address = optional(string) description = optional(string, "Terraform managed.") labels = optional(map(string)) name = optional(string) purpose = optional(string) tier = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [ipsec_interconnect_addresses](variables.tf#L49) | Map of internal addresses used for HPA VPN over Cloud Interconnect. | <code title="map(object({ region = string address = string network = string description = optional(string, "Terraform managed.") name = optional(string) prefix_length = number }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psa_addresses](variables.tf#L73) | Map of internal addresses used for Private Service Access. | <code title="map(object({ address = string network = string prefix_length = number description = optional(string, "Terraform managed.") name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [psc_addresses](variables.tf#L86) | Map of internal addresses used for Private Service Connect. | <code title="map(object({ address = string network = string description = optional(string, "Terraform managed.") name = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ resource "google_compute_address" "external" {
|
|||
provider = google-beta
|
||||
for_each = var.external_addresses
|
||||
project = var.project_id
|
||||
name = each.key
|
||||
name = coalesce(each.value.name, each.key)
|
||||
description = each.value.description
|
||||
address_type = "EXTERNAL"
|
||||
region = each.value.region
|
||||
|
@ -35,7 +35,7 @@ resource "google_compute_address" "internal" {
|
|||
provider = google-beta
|
||||
for_each = var.internal_addresses
|
||||
project = var.project_id
|
||||
name = each.key
|
||||
name = coalesce(each.value.name, each.key)
|
||||
description = each.value.description
|
||||
address_type = "INTERNAL"
|
||||
region = each.value.region
|
||||
|
@ -49,7 +49,7 @@ resource "google_compute_address" "internal" {
|
|||
resource "google_compute_global_address" "psc" {
|
||||
for_each = var.psc_addresses
|
||||
project = var.project_id
|
||||
name = each.key
|
||||
name = coalesce(each.value.name, each.key)
|
||||
description = each.value.description
|
||||
address = try(each.value.address, null)
|
||||
address_type = "INTERNAL"
|
||||
|
@ -61,7 +61,7 @@ resource "google_compute_global_address" "psc" {
|
|||
resource "google_compute_global_address" "psa" {
|
||||
for_each = var.psa_addresses
|
||||
project = var.project_id
|
||||
name = each.key
|
||||
name = coalesce(each.value.name, each.key)
|
||||
description = each.value.description
|
||||
address = each.value.address
|
||||
address_type = "INTERNAL"
|
||||
|
@ -74,7 +74,7 @@ resource "google_compute_global_address" "psa" {
|
|||
resource "google_compute_address" "ipsec_interconnect" {
|
||||
for_each = var.ipsec_interconnect_addresses
|
||||
project = var.project_id
|
||||
name = each.key
|
||||
name = coalesce(each.value.name, each.key)
|
||||
description = each.value.description
|
||||
address = each.value.address
|
||||
address_type = "INTERNAL"
|
||||
|
|
|
@ -20,6 +20,7 @@ variable "external_addresses" {
|
|||
region = string
|
||||
description = optional(string, "Terraform managed.")
|
||||
labels = optional(map(string), {})
|
||||
name = optional(string)
|
||||
}))
|
||||
default = {}
|
||||
}
|
||||
|
@ -38,6 +39,7 @@ variable "internal_addresses" {
|
|||
address = optional(string)
|
||||
description = optional(string, "Terraform managed.")
|
||||
labels = optional(map(string))
|
||||
name = optional(string)
|
||||
purpose = optional(string)
|
||||
tier = optional(string)
|
||||
}))
|
||||
|
@ -51,6 +53,7 @@ variable "ipsec_interconnect_addresses" {
|
|||
address = string
|
||||
network = string
|
||||
description = optional(string, "Terraform managed.")
|
||||
name = optional(string)
|
||||
prefix_length = number
|
||||
}))
|
||||
default = {}
|
||||
|
@ -72,8 +75,10 @@ variable "psa_addresses" {
|
|||
type = map(object({
|
||||
address = string
|
||||
network = string
|
||||
description = optional(string, "Terraform managed.")
|
||||
prefix_length = number
|
||||
description = optional(string, "Terraform managed.")
|
||||
name = optional(string)
|
||||
|
||||
}))
|
||||
default = {}
|
||||
}
|
||||
|
@ -84,6 +89,7 @@ variable "psc_addresses" {
|
|||
address = string
|
||||
network = string
|
||||
description = optional(string, "Terraform managed.")
|
||||
name = optional(string)
|
||||
}))
|
||||
default = {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue