Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding optional description field to created subnets #66

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module "vpc" {
subnet_region = "us-west1"
subnet_private_access = "true"
subnet_flow_logs = "true"
description = "This subnet has a description"
},
]

Expand Down Expand Up @@ -121,6 +122,7 @@ The subnets list contains maps, where each object represents a subnet. Each map
| subnet_region | The region where the subnet will be created | string | - | yes |
| subnet_private_access | Whether this subnet will have private Google access enabled | string | false | no |
| subnet_flow_logs | Whether the subnet will record and send flow log data to logging | string | false | no |
| description | The description of the subnet being created | string | null | no |

### Route Inputs
The routes list contains maps, where each object represents a route. For the next_hop_* inputs, only one is possible to be used in each route. Having two next_hop_* inputs will produce an error. Each map has the following inputs (please see examples folder for additional references):
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ resource "google_compute_subnetwork" "subnetwork" {
network = google_compute_network.network.name
project = var.project_id
secondary_ip_range = [for i in range(length(contains(keys(var.secondary_ranges), var.subnets[count.index]["subnet_name"]) == true ? var.secondary_ranges[var.subnets[count.index]["subnet_name"]] : [])) : var.secondary_ranges[var.subnets[count.index]["subnet_name"]][i]]
description = lookup(var.subnets[count.index], "description", null)
}

data "google_compute_subnetwork" "created_subnets" {
Expand Down Expand Up @@ -98,4 +99,3 @@ resource "null_resource" "delete_default_internet_gateway_routes" {
google_compute_route.route,
]
}