-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from terraform-google-modules/adrienthebo/add-…
…secondary-ranges-example Add example with single VPC and more complex secondary networks
- Loading branch information
Showing
4 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Secondary Ranges | ||
|
||
This example configures a single simple VPC inside of a project. | ||
|
||
This VPC has three subnets, with the first subnet being given two secondary | ||
ranges and the third being given a single secondary range. | ||
|
||
[^]: (autogen_docs_start) | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|:----:|:-----:|:-----:| | ||
| project\_id | The project ID to host the network in | string | - | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| network\_name | The name of the VPC being created | | ||
| network\_self\_link | The URI of the VPC being created | | ||
| routes | The routes associated with this VPC | | ||
| subnets\_flow\_logs | Whether the subnets will have VPC flow logs enabled | | ||
| subnets\_ips | The IP and cidrs of the subnets being created | | ||
| subnets\_names | The names of the subnets being created | | ||
| subnets\_private\_access | Whether the subnets will have access to Google API's without a public IP | | ||
| subnets\_regions | The region where subnets will be created | | ||
| subnets\_secondary\_ranges | The secondary ranges associated with these subnets | | ||
|
||
[^]: (autogen_docs_end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* Copyright 2018 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module "vpc-secondary-ranges" { | ||
source = "../../" | ||
project_id = "${var.project_id}" | ||
network_name = "vpc-secondary-ranges" | ||
|
||
subnets = [ | ||
{ | ||
subnet_name = "secondary-ranges-subnet-01" | ||
subnet_ip = "10.10.10.0/24" | ||
subnet_region = "us-west1" | ||
}, | ||
{ | ||
subnet_name = "secondary-ranges-subnet-02" | ||
subnet_ip = "10.10.20.0/24" | ||
subnet_region = "us-west1" | ||
subnet_private_access = "true" | ||
subnet_flow_logs = "true" | ||
}, | ||
{ | ||
subnet_name = "secondary-ranges-subnet-03" | ||
subnet_ip = "10.10.30.0/24" | ||
subnet_region = "us-west1" | ||
}, | ||
] | ||
|
||
secondary_ranges = { | ||
secondary-ranges-subnet-01 = [ | ||
{ | ||
range_name = "subnet-01-01" | ||
ip_cidr_range = "192.168.64.0/24" | ||
}, | ||
{ | ||
range_name = "subnet-01-02" | ||
ip_cidr_range = "192.168.65.0/24" | ||
}, | ||
] | ||
secondary-ranges-subnet-02 = [] | ||
secondary-ranges-subnet-03 = [ | ||
{ | ||
range_name = "subnet-03-01" | ||
ip_cidr_range = "192.168.66.0/24" | ||
}, | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Copyright 2018 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
output "network_name" { | ||
value = "${module.vpc-secondary-ranges.network_name}" | ||
description = "The name of the VPC being created" | ||
} | ||
|
||
output "network_self_link" { | ||
value = "${module.vpc-secondary-ranges.network_self_link}" | ||
description = "The URI of the VPC being created" | ||
} | ||
|
||
output "subnets_names" { | ||
value = "${module.vpc-secondary-ranges.subnets_names}" | ||
description = "The names of the subnets being created" | ||
} | ||
|
||
output "subnets_ips" { | ||
value = "${module.vpc-secondary-ranges.subnets_ips}" | ||
description = "The IP and cidrs of the subnets being created" | ||
} | ||
|
||
output "subnets_regions" { | ||
value = "${module.vpc-secondary-ranges.subnets_regions}" | ||
description = "The region where subnets will be created" | ||
} | ||
|
||
output "subnets_private_access" { | ||
value = "${module.vpc-secondary-ranges.subnets_private_access}" | ||
description = "Whether the subnets will have access to Google API's without a public IP" | ||
} | ||
|
||
output "subnets_flow_logs" { | ||
value = "${module.vpc-secondary-ranges.subnets_flow_logs}" | ||
description = "Whether the subnets will have VPC flow logs enabled" | ||
} | ||
|
||
output "subnets_secondary_ranges" { | ||
value = "${flatten(module.vpc-secondary-ranges.subnets_secondary_ranges)}" | ||
description = "The secondary ranges associated with these subnets" | ||
} | ||
|
||
output "routes" { | ||
value = "${module.vpc-secondary-ranges.routes}" | ||
description = "The routes associated with this VPC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright 2018 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
variable "project_id" { | ||
description = "The project ID to host the network in" | ||
} |