Skip to content

Commit 7e36a24

Browse files
dadangnhapeabodyg-awmalik
authored
feat: add support for descriptions argument (#136)
Co-authored-by: Andrew Peabody <[email protected]> Co-authored-by: Awais Malik <[email protected]>
1 parent 6646a23 commit 7e36a24

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Terraform may change this fact, but this is the current limitation.
184184
|------|-------------|------|---------|:--------:|
185185
| address\_type | The type of address to reserve, either "INTERNAL" or "EXTERNAL". If unspecified, defaults to "INTERNAL". | `string` | `"INTERNAL"` | no |
186186
| addresses | A list of IP addresses to create. GCP will reserve unreserved addresses if given the value "". If multiple names are given the default value is sufficient to have multiple addresses automatically picked for each name. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
187+
| descriptions | A list of descriptions to add to each address. | `list(string)` | `[]` | no |
187188
| dns\_domain | The domain to append to DNS short names when registering in Cloud DNS. | `string` | `""` | no |
188189
| dns\_managed\_zone | The name of the managed zone to create records within. This managed zone must exist in the host project. | `string` | `""` | no |
189190
| dns\_project | The project where DNS A records will be configured. | `string` | `""` | no |

main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ resource "google_compute_address" "ip" {
5858
purpose = var.address_type == "INTERNAL" ? var.purpose : null
5959
network_tier = var.address_type == "INTERNAL" ? null : var.network_tier
6060
labels = var.labels
61+
description = try(element(var.descriptions, count.index), null)
6162
}
6263

6364
resource "google_compute_global_address" "global_ip" {
@@ -70,6 +71,7 @@ resource "google_compute_global_address" "global_ip" {
7071
purpose = var.global && var.address_type == "INTERNAL" ? "VPC_PEERING" : null
7172
prefix_length = local.prefix_length
7273
ip_version = var.ip_version
74+
description = try(element(var.descriptions, count.index), null)
7375
}
7476

7577
/******************************************

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,9 @@ variable "labels" {
137137
description = "Labels to apply to this address."
138138
default = {}
139139
}
140+
141+
variable "descriptions" {
142+
description = "A list of descriptions to add to each address."
143+
type = list(string)
144+
default = []
145+
}

0 commit comments

Comments
 (0)