Skip to content

Commit

Permalink
Merge pull request #66 from tfhartmann/tfhartmann-adding-description
Browse files Browse the repository at this point in the history
feat: adding optional description field to created subnets
  • Loading branch information
morgante authored Sep 6, 2019
2 parents 6575822 + 011e273 commit b75d5c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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,
]
}

0 comments on commit b75d5c5

Please sign in to comment.