Skip to content

Commit 73a1d4b

Browse files
authored
Merge pull request #94 from terraform-google-modules/aaron-lane-fix-outputs
Fix values of outputs
2 parents dfea366 + a452948 commit 73a1d4b

File tree

8 files changed

+21
-12
lines changed

8 files changed

+21
-12
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning][semver-site].
77

88
## [Unreleased]
99

10+
## [1.4.2] - 2019-10-30
11+
12+
### Fixed
13+
14+
- The outputs `network_name`, `network_self_link`, and
15+
`subnets_secondary_ranges` depend on resource attributes rather than
16+
data source attributes when `create_network` = `true`. [#94]
17+
1018
## [1.4.1] - 2019-10-29
1119

1220
### Added
@@ -132,7 +140,8 @@ and this project adheres to [Semantic Versioning][semver-site].
132140
- Subnets within the VPC
133141
- Secondary ranges for the subnets (if applicable)
134142

135-
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.1...HEAD
143+
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.2...HEAD
144+
[1.4.2]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.1...v1.4.2
136145
[1.4.1]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.0...v1.4.1
137146
[1.4.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.3.0...v1.4.0
138147
[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].
148157
[0.2.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v0.1.0...v0.2.0
149158
[0.1.0]: https://github.com/terraform-google-modules/terraform-google-network/releases/tag/v0.1.0
150159

160+
[#94]: https://github.com/terraform-google-modules/terraform-google-network/pull/94
151161
[#92]: https://github.com/terraform-google-modules/terraform-google-network/issues/92
152162
[#88]: https://github.com/terraform-google-modules/terraform-google-network/issues/88
153163
[#81]: https://github.com/terraform-google-modules/terraform-google-network/pull/81

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Make will use bash instead of sh
1616
SHELL := /usr/bin/env bash
1717

18-
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.1.0
18+
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.5.0
1919
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2020
REGISTRY_URL := gcr.io/cloud-foundation-cicd
2121

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Then perform the following commands on the root folder:
8484
| Name | Description | Type | Default | Required |
8585
|------|-------------|:----:|:-----:|:-----:|
8686
| 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 |
87-
| create\_network | Specify whether to create a new network or just assume it already exists. | string | `"true"` | no |
87+
| create\_network | Specify whether to create a new network or just assume it already exists. | bool | `"true"` | no |
8888
| 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 |
8989
| description | An optional description of this resource. The resource must be recreated to modify this field. | string | `""` | no |
9090
| network\_name | The name of the network being created | string | n/a | yes |

build/int.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ tags:
3838
- 'integration'
3939
substitutions:
4040
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
41-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.1.0'
41+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.5.0'

build/lint.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ tags:
2121
- 'lint'
2222
substitutions:
2323
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
24-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.1.0'
24+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.5.0'

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
VPC configuration
1919
*****************************************/
2020
resource "google_compute_network" "network" {
21-
count = var.create_network == "true" ? 1 : 0
21+
count = var.create_network ? 1 : 0
2222
name = var.network_name
2323
auto_create_subnetworks = var.auto_create_subnetworks
2424
routing_mode = var.routing_mode

outputs.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
*/
1616

1717
output "network_name" {
18-
value = data.google_compute_network.network.name
18+
value = var.create_network ? google_compute_network.network[0].name : data.google_compute_network.network.name
1919
description = "The name of the VPC being created"
2020
}
2121

2222
output "network_self_link" {
23-
value = data.google_compute_network.network.self_link
23+
value = var.create_network ? google_compute_network.network[0].self_link : data.google_compute_network.network.self_link
2424
description = "The URI of the VPC being created"
2525
}
2626

@@ -60,12 +60,11 @@ output "subnets_flow_logs" {
6060
}
6161

6262
output "subnets_secondary_ranges" {
63-
value = data.google_compute_subnetwork.created_subnets.*.secondary_ip_range
63+
value = google_compute_subnetwork.subnetwork[*].secondary_ip_range
6464
description = "The secondary ranges associated with these subnets"
6565
}
6666

6767
output "routes" {
6868
value = google_compute_route.route.*.name
6969
description = "The routes associated with this VPC"
7070
}
71-

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ variable "project_id" {
1919
}
2020

2121
variable "create_network" {
22-
type = string
23-
default = "true"
22+
type = bool
23+
default = true
2424
description = "Specify whether to create a new network or just assume it already exists."
2525
}
2626

0 commit comments

Comments
 (0)