diff --git a/CHANGELOG.md b/CHANGELOG.md index d96d2509..c6ac6743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning][semver-site]. ## [Unreleased] +## [1.4.2] - 2019-10-30 + +### Fixed + +- The outputs `network_name`, `network_self_link`, and + `subnets_secondary_ranges` depend on resource attributes rather than + data source attributes when `create_network` = `true`. [#94] + ## [1.4.1] - 2019-10-29 ### Added @@ -132,7 +140,8 @@ and this project adheres to [Semantic Versioning][semver-site]. - Subnets within the VPC - Secondary ranges for the subnets (if applicable) -[Unreleased]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.1...HEAD +[Unreleased]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.2...HEAD +[1.4.2]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.1...v1.4.2 [1.4.1]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.0...v1.4.1 [1.4.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.3.0...v1.4.0 [1.3.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.2.0...v1.3.0 @@ -148,6 +157,7 @@ and this project adheres to [Semantic Versioning][semver-site]. [0.2.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/terraform-google-modules/terraform-google-network/releases/tag/v0.1.0 +[#94]: https://github.com/terraform-google-modules/terraform-google-network/pull/94 [#92]: https://github.com/terraform-google-modules/terraform-google-network/issues/92 [#88]: https://github.com/terraform-google-modules/terraform-google-network/issues/88 [#81]: https://github.com/terraform-google-modules/terraform-google-network/pull/81 diff --git a/Makefile b/Makefile index 69ee80e1..b415692e 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # Make will use bash instead of sh SHELL := /usr/bin/env bash -DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.1.0 +DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.5.0 DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools REGISTRY_URL := gcr.io/cloud-foundation-cicd diff --git a/README.md b/README.md index 492054cf..df6206eb 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | auto\_create\_subnetworks | When set to true, the network is created in 'auto subnet mode' and it will create a subnet for each region automatically across the 10.128.0.0/9 address range. When set to false, the network is created in 'custom subnet mode' so the user can explicitly connect subnetwork resources. | bool | `"false"` | no | -| create\_network | Specify whether to create a new network or just assume it already exists. | string | `"true"` | no | +| create\_network | Specify whether to create a new network or just assume it already exists. | bool | `"true"` | no | | delete\_default\_internet\_gateway\_routes | If set, ensure that all routes within the network specified whose names begin with 'default-route' and with a next hop of 'default-internet-gateway' are deleted | string | `"false"` | no | | description | An optional description of this resource. The resource must be recreated to modify this field. | string | `""` | no | | network\_name | The name of the network being created | string | n/a | yes | diff --git a/build/int.cloudbuild.yaml b/build/int.cloudbuild.yaml index 299ca3e8..364eebcd 100644 --- a/build/int.cloudbuild.yaml +++ b/build/int.cloudbuild.yaml @@ -38,4 +38,4 @@ tags: - 'integration' substitutions: _DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools' - _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.1.0' + _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.5.0' diff --git a/build/lint.cloudbuild.yaml b/build/lint.cloudbuild.yaml index b2d4c569..fb860e81 100644 --- a/build/lint.cloudbuild.yaml +++ b/build/lint.cloudbuild.yaml @@ -21,4 +21,4 @@ tags: - 'lint' substitutions: _DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools' - _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.1.0' + _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.5.0' diff --git a/main.tf b/main.tf index 6fd82bea..06858a12 100644 --- a/main.tf +++ b/main.tf @@ -18,7 +18,7 @@ VPC configuration *****************************************/ resource "google_compute_network" "network" { - count = var.create_network == "true" ? 1 : 0 + count = var.create_network ? 1 : 0 name = var.network_name auto_create_subnetworks = var.auto_create_subnetworks routing_mode = var.routing_mode diff --git a/outputs.tf b/outputs.tf index dee7c1ac..8fad3270 100644 --- a/outputs.tf +++ b/outputs.tf @@ -15,12 +15,12 @@ */ output "network_name" { - value = data.google_compute_network.network.name + value = var.create_network ? google_compute_network.network[0].name : data.google_compute_network.network.name description = "The name of the VPC being created" } output "network_self_link" { - value = data.google_compute_network.network.self_link + value = var.create_network ? google_compute_network.network[0].self_link : data.google_compute_network.network.self_link description = "The URI of the VPC being created" } @@ -60,7 +60,7 @@ output "subnets_flow_logs" { } output "subnets_secondary_ranges" { - value = data.google_compute_subnetwork.created_subnets.*.secondary_ip_range + value = google_compute_subnetwork.subnetwork[*].secondary_ip_range description = "The secondary ranges associated with these subnets" } @@ -68,4 +68,3 @@ output "routes" { value = google_compute_route.route.*.name description = "The routes associated with this VPC" } - diff --git a/variables.tf b/variables.tf index 023e0d69..4902e430 100644 --- a/variables.tf +++ b/variables.tf @@ -19,8 +19,8 @@ variable "project_id" { } variable "create_network" { - type = string - default = "true" + type = bool + default = true description = "Specify whether to create a new network or just assume it already exists." }