Created
May 27, 2022 16:49
-
-
Save JamesAtIntegratnIO/f484a954ef91158bf3432caac393d1c0 to your computer and use it in GitHub Desktop.
GCP Subnet output with secondary IP Ranges example
This file contains hidden or 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
| locals { | |
| subnets = { | |
| subnet1 = { | |
| name = "subnet1" | |
| ip_cidr_range = "10.0.0.0/24" | |
| description = "description for subnet1" | |
| region = "region1" | |
| log_config = { | |
| aggregation_interval = "interval1" | |
| flow_sampling = 0.5 | |
| metadata = "metadata1" | |
| } | |
| secondary_ip_range = [ | |
| { | |
| range_name = "secondary_range_1" | |
| ip_cidr_range = "10.0.1.0/24" | |
| }, | |
| { | |
| range_name = "secondary_range_2" | |
| ip_cidr_range = "10.0.2.0/24" | |
| } | |
| ] | |
| } | |
| subnet2 = { | |
| name = "subnet2" | |
| ip_cidr_range = "10.0.3.0/24" | |
| description = "description for subnet2" | |
| region = "region1" | |
| log_config = { | |
| aggregation_interval = "interval2" | |
| flow_sampling = 0.5 | |
| metadata = "metadata2" | |
| } | |
| secondary_ip_range = [ | |
| { | |
| range_name = "secondary_range_1" | |
| ip_cidr_range = "10.0.4.0/24" | |
| }, | |
| { | |
| range_name = "secondary_range_2" | |
| ip_cidr_range = "10.0.5.0/24" | |
| } | |
| ] | |
| } | |
| subnet3 = { | |
| name = "subnet3" | |
| ip_cidr_range = "10.0.6.0/24" | |
| description = "description for subnet3" | |
| region = "region1" | |
| log_config = { | |
| aggregation_interval = "interval3" | |
| flow_sampling = 0.5 | |
| metadata = "metadata3" | |
| } | |
| secondary_ip_range = [ | |
| { | |
| range_name = "secondary_range_1" | |
| ip_cidr_range = "10.0.7.0/24" | |
| }, | |
| { | |
| range_name = "secondary_range_2" | |
| ip_cidr_range = "10.0.8.0/24" | |
| } | |
| ] | |
| } | |
| } | |
| } |
This file contains hidden or 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
| output "subnets" { | |
| value = { for s in local.subnets : s.name => { | |
| "name" = s.name, | |
| "ip_cidr_range" = s.ip_cidr_range, | |
| "secondary_ip_range" = { for k in s.secondary_ip_range : k.range_name => { | |
| "name" = k.range_name, | |
| "ip_cidr_range" = k.ip_cidr_range | |
| } } | |
| } } | |
| } |
This file contains hidden or 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
| subnets = { | |
| "subnet1" = { | |
| "ip_cidr_range" = "10.0.0.0/24" | |
| "name" = "subnet1" | |
| "secondary_ip_range" = { | |
| "secondary_range_1" = { | |
| "ip_cidr_range" = "10.0.1.0/24" | |
| "name" = "secondary_range_1" | |
| } | |
| "secondary_range_2" = { | |
| "ip_cidr_range" = "10.0.2.0/24" | |
| "name" = "secondary_range_2" | |
| } | |
| } | |
| } | |
| "subnet2" = { | |
| "ip_cidr_range" = "10.0.3.0/24" | |
| "name" = "subnet2" | |
| "secondary_ip_range" = { | |
| "secondary_range_1" = { | |
| "ip_cidr_range" = "10.0.4.0/24" | |
| "name" = "secondary_range_1" | |
| } | |
| "secondary_range_2" = { | |
| "ip_cidr_range" = "10.0.5.0/24" | |
| "name" = "secondary_range_2" | |
| } | |
| } | |
| } | |
| "subnet3" = { | |
| "ip_cidr_range" = "10.0.6.0/24" | |
| "name" = "subnet3" | |
| "secondary_ip_range" = { | |
| "secondary_range_1" = { | |
| "ip_cidr_range" = "10.0.7.0/24" | |
| "name" = "secondary_range_1" | |
| } | |
| "secondary_range_2" = { | |
| "ip_cidr_range" = "10.0.8.0/24" | |
| "name" = "secondary_range_2" | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment