Skip to content

Commit 011e273

Browse files
committed
Merge branch 'master' into tfhartmann-adding-description
2 parents 6556120 + 6575822 commit 011e273

File tree

12 files changed

+49
-30
lines changed

12 files changed

+49
-30
lines changed

CHANGELOG.md

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

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Made setting `secondary_ranges` optional. [#16]
13+
1014
## [1.1.0] - 2019-07-24
1115

1216
### Added
@@ -103,6 +107,8 @@ and this project adheres to [Semantic Versioning][semver-site].
103107
[0.3.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v0.2.0...v0.3.0
104108
[0.2.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v0.1.0...v0.2.0
105109
[0.1.0]: https://github.com/terraform-google-modules/terraform-google-network/releases/tag/v0.1.0
110+
111+
[#16]: https://github.com/terraform-google-modules/terraform-google-network/pull/16
106112
[#57]: https://github.com/terraform-google-modules/terraform-google-network/pull/57
107113
[#47]: https://github.com/terraform-google-modules/terraform-google-network/pull/47
108114
[#45]: https://github.com/terraform-google-modules/terraform-google-network/pull/45

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Then perform the following commands on the root folder:
9090
| project\_id | The ID of the project where this VPC will be created | string | n/a | yes |
9191
| routes | List of routes being created in this VPC | list(map(string)) | `<list>` | no |
9292
| routing\_mode | The network routing mode (default 'GLOBAL') | string | `"GLOBAL"` | no |
93-
| secondary\_ranges | Secondary ranges that will be used in some of the subnets | object | n/a | yes |
93+
| secondary\_ranges | Secondary ranges that will be used in some of the subnets | object | `<map>` | no |
9494
| shared\_vpc\_host | Makes this project a Shared VPC host if 'true' (default 'false') | string | `"false"` | no |
9595
| subnets | The list of subnets being created | list(map(string)) | n/a | yes |
9696

examples/delete_default_gateway_routes/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,4 @@ module "test-vpc-module" {
3939
subnet_region = "us-west1"
4040
},
4141
]
42-
43-
secondary_ranges = {
44-
"${local.subnet_01}" = []
45-
}
4642
}

examples/multi_vpc/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ module "test-vpc-module-01" {
104104
ip_cidr_range = "192.168.74.0/24"
105105
},
106106
]
107-
108-
"${local.network_01_subnet_03}" = []
109107
}
110108

111109
routes = "${local.network_01_routes}"
@@ -140,8 +138,6 @@ module "test-vpc-module-02" {
140138
ip_cidr_range = "192.168.75.0/24"
141139
},
142140
]
143-
144-
"${local.network_02_subnet_02}" = []
145141
}
146142

147143
routes = local.network_02_routes

examples/secondary_ranges/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ locals {
2626
subnet_01 = "${var.network_name}-subnet-01"
2727
subnet_02 = "${var.network_name}-subnet-02"
2828
subnet_03 = "${var.network_name}-subnet-03"
29+
subnet_04 = "${var.network_name}-subnet-04"
2930
}
3031

3132
module "vpc-secondary-ranges" {
@@ -51,6 +52,11 @@ module "vpc-secondary-ranges" {
5152
subnet_ip = "10.10.30.0/24"
5253
subnet_region = "us-west1"
5354
},
55+
{
56+
subnet_name = "${local.subnet_04}"
57+
subnet_ip = "10.10.40.0/24"
58+
subnet_region = "us-west1"
59+
},
5460
]
5561

5662
secondary_ranges = {

examples/simple_project/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,4 @@ module "test-vpc-module" {
4646
subnet_flow_logs = "true"
4747
},
4848
]
49-
50-
secondary_ranges = {
51-
"${local.subnet_01}" = []
52-
"${local.subnet_02}" = []
53-
}
5449
}

examples/simple_project_with_regional_network/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,4 @@ module "test-vpc-module" {
4747
subnet_flow_logs = "true"
4848
},
4949
]
50-
51-
secondary_ranges = {
52-
"${local.subnet_01}" = []
53-
"${local.subnet_02}" = []
54-
}
5550
}

examples/submodule_firewall/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ module "test-vpc-module" {
4646
subnet_flow_logs = "true"
4747
},
4848
]
49-
50-
secondary_ranges = {
51-
"${local.subnet_01}" = []
52-
"${local.subnet_02}" = []
53-
}
5449
}
5550

5651
module "test-firewall-submodule" {

examples/submodule_svpc_access/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ module "net-vpc-shared" {
3737
subnet_region = "europe-west1"
3838
},
3939
]
40-
41-
secondary_ranges = {
42-
first = []
43-
second = []
44-
}
4540
}
4641

4742
module "net-svpc-access" {

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ resource "google_compute_subnetwork" "subnetwork" {
4747
enable_flow_logs = lookup(var.subnets[count.index], "subnet_flow_logs", "false")
4848
network = google_compute_network.network.name
4949
project = var.project_id
50-
secondary_ip_range = var.secondary_ranges[lookup(var.subnets[count.index], "subnet_name", null)]
50+
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]]
5151
description = lookup(var.subnets[count.index], "description", null)
5252
}
5353

0 commit comments

Comments
 (0)