Skip to content

Commit 7663f6a

Browse files
authored
Merge pull request #21 from terraform-google-modules/morgante/simplify-secondary-example
Remove secondary networks from simple example
2 parents 450e024 + 8e6deaa commit 7663f6a

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

CHANGELOG.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
## 0.4.0
1+
## [Unreleased]
2+
### Fixed
3+
- Resolved issue with networks that have no secondary networks (#19)
24

5+
## 0.4.0
6+
### Changed
37
- Make `subnet_private_access` and `subnet_flow_logs` into strings to be consistent with `shared_vpc` flag (#13)
48

59
## 0.3.0
6-
10+
### Added
711
- Add support for controlling subnet flow logs (#6)
12+
13+
### Changed
814
- Make `subnet_private_access` default to false (#6)
915

1016
## 0.2.0
11-
17+
### Added
1218
- Add support for Shared VPC hosting
1319

1420
## 0.1.0
1521

16-
This is the initial release of the module, with basic support for creating:
17-
22+
### Added
23+
- Initial release
1824
- A Google Virtual Private Network (VPC)
1925
- Subnets within the VPC
2026
- Secondary ranges for the subnets (if applicable)

examples/simple_project/README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@
22

33
This example configures a single simple VPC inside of a project.
44

5-
This VPC has two subnets, with the first subnet being given a single secondary range.
5+
This VPC has two subnets, with no secondary ranges.
66

77
[^]: (autogen_docs_start)
88

9-
109
## Inputs
1110

1211
| Name | Description | Type | Default | Required |
1312
|------|-------------|:----:|:-----:|:-----:|
14-
| project_id | The project ID to host the network in | string | - | yes |
13+
| project\_id | The project ID to host the network in | string | - | yes |
1514

1615
## Outputs
1716

1817
| Name | Description |
1918
|------|-------------|
20-
| network_name | The name of the VPC being created |
21-
| network_self_link | The URI of the VPC being created |
22-
| subnets_flow_logs | Whether the subnets will have VPC flow logs enabled |
23-
| subnets_ips | The IP and cidrs of the subnets being created |
24-
| subnets_names | The names of the subnets being created |
25-
| subnets_private_access | Whether the subnets will have access to Google API's without a public IP |
26-
| subnets_regions | The region where subnets will be created |
27-
| subnets_secondary_ranges | The secondary ranges associated with these subnets |
19+
| network\_name | The name of the VPC being created |
20+
| network\_self\_link | The URI of the VPC being created |
2821
| routes | The routes associated with this VPC |
22+
| subnets\_flow\_logs | Whether the subnets will have VPC flow logs enabled |
23+
| subnets\_ips | The IP and cidrs of the subnets being created |
24+
| subnets\_names | The names of the subnets being created |
25+
| subnets\_private\_access | Whether the subnets will have access to Google API's without a public IP |
26+
| subnets\_regions | The region where subnets will be created |
27+
| subnets\_secondary\_ranges | The secondary ranges associated with these subnets |
2928

3029
[^]: (autogen_docs_end)

examples/simple_project/main.tf

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ module "test-vpc-module" {
3535
]
3636

3737
secondary_ranges = {
38-
subnet-01 = [
39-
{
40-
range_name = "subnet-01-secondary-01"
41-
ip_cidr_range = "192.168.64.0/24"
42-
},
43-
]
44-
38+
subnet-01 = []
4539
subnet-02 = []
4640
}
4741
}

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ resource "google_compute_subnetwork" "subnetwork" {
5252
data "google_compute_subnetwork" "created_subnets" {
5353
count = "${length(var.subnets)}"
5454

55-
name = "${lookup(var.subnets[count.index], "subnet_name")}"
56-
region = "${lookup(var.subnets[count.index], "subnet_region")}"
55+
name = "${element(google_compute_subnetwork.subnetwork.*.name, count.index)}"
56+
region = "${element(google_compute_subnetwork.subnetwork.*.region, count.index)}"
5757
project = "${var.project_id}"
5858
}
5959

0 commit comments

Comments
 (0)