Skip to content

Commit 84b3a05

Browse files
committed
Add example and clarify what values can be set for 'routing_mode'
1 parent 78919fc commit 84b3a05

File tree

5 files changed

+151
-1
lines changed

5 files changed

+151
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Then perform the following commands on the root folder:
8181
| Name | Description | Type | Default | Required |
8282
|------|-------------|:----:|:-----:|:-----:|
8383
| network_name | The name of the network being created | string | - | yes |
84-
| routing_mode | The network routing mode (default 'GLOBAL') | string | GLOBAL | no |
84+
| routing_mode | The network routing mode. Can be either 'REGIONAL' or 'GLOBAL' | string | GLOBAL | no |
8585
| project_id | The ID of the project where this VPC will be created | string | - | yes |
8686
| shared_vpc_host | Makes this project a Shared VPC host if 'true' (default 'false') | string | `false` | no |
8787
| subnets | The list of subnets being created | list | - | yes |
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Simple Project
2+
3+
This example configures a single simple regional VPC inside of a project.
4+
5+
This VPC has two subnets, with no secondary ranges.
6+
7+
[^]: (autogen_docs_start)
8+
9+
## Inputs
10+
11+
| Name | Description | Type | Default | Required |
12+
|------|-------------|:----:|:-----:|:-----:|
13+
| project\_id | The project ID to host the network in | string | - | yes |
14+
15+
## Outputs
16+
17+
| Name | Description |
18+
|------|-------------|
19+
| network\_name | The name of the VPC being created |
20+
| network\_self\_link | The URI of the VPC being created |
21+
| 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 |
28+
29+
[^]: (autogen_docs_end)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module "test-vpc-module" {
18+
source = "../../"
19+
project_id = "${var.project_id}"
20+
network_name = "test-vpc-module"
21+
routing_mode = "REGIONAL"
22+
23+
subnets = [
24+
{
25+
subnet_name = "subnet-01"
26+
subnet_ip = "10.10.10.0/24"
27+
subnet_region = "us-west1"
28+
},
29+
{
30+
subnet_name = "subnet-02"
31+
subnet_ip = "10.10.20.0/24"
32+
subnet_region = "us-west1"
33+
subnet_private_access = "true"
34+
subnet_flow_logs = "true"
35+
},
36+
]
37+
38+
secondary_ranges = {
39+
subnet-01 = []
40+
subnet-02 = []
41+
}
42+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
output "network_name" {
18+
value = "${module.test-vpc-module.network_name}"
19+
description = "The name of the VPC being created"
20+
}
21+
22+
output "network_self_link" {
23+
value = "${module.test-vpc-module.network_self_link}"
24+
description = "The URI of the VPC being created"
25+
}
26+
27+
output "subnets_names" {
28+
value = "${module.test-vpc-module.subnets_names}"
29+
description = "The names of the subnets being created"
30+
}
31+
32+
output "subnets_ips" {
33+
value = "${module.test-vpc-module.subnets_ips}"
34+
description = "The IP and cidrs of the subnets being created"
35+
}
36+
37+
output "subnets_regions" {
38+
value = "${module.test-vpc-module.subnets_regions}"
39+
description = "The region where subnets will be created"
40+
}
41+
42+
output "subnets_private_access" {
43+
value = "${module.test-vpc-module.subnets_private_access}"
44+
description = "Whether the subnets will have access to Google API's without a public IP"
45+
}
46+
47+
output "subnets_flow_logs" {
48+
value = "${module.test-vpc-module.subnets_flow_logs}"
49+
description = "Whether the subnets will have VPC flow logs enabled"
50+
}
51+
52+
output "subnets_secondary_ranges" {
53+
value = "${module.test-vpc-module.subnets_secondary_ranges}"
54+
description = "The secondary ranges associated with these subnets"
55+
}
56+
57+
output "routes" {
58+
value = "${module.test-vpc-module.routes}"
59+
description = "The routes associated with this VPC"
60+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
variable "project_id" {
18+
description = "The project ID to host the network in"
19+
}

0 commit comments

Comments
 (0)