Skip to content

Commit

Permalink
feat: Promote role and purpose of subnet to GA (#343)
Browse files Browse the repository at this point in the history
* add role and purpose

* use upgraded syntax

* bump version
  • Loading branch information
upodroid authored Jan 10, 2022
1 parent 1e2d68a commit 8b98a36
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
10 changes: 5 additions & 5 deletions examples/multi_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module "test-vpc-module-01" {
]

secondary_ranges = {
"${local.network_01_subnet_01}" = [
(local.network_01_subnet_01) = [
{
range_name = "${local.network_01_subnet_01}-01"
ip_cidr_range = "192.168.64.0/24"
Expand All @@ -90,7 +90,7 @@ module "test-vpc-module-01" {
},
]

"${local.network_01_subnet_02}" = [
(local.network_01_subnet_02) = [
{
range_name = "${local.network_02_subnet_01}-01"
ip_cidr_range = "192.168.74.0/24"
Expand All @@ -108,14 +108,14 @@ module "test-vpc-module-02" {

subnets = [
{
subnet_name = "${local.network_02_subnet_01}"
subnet_name = local.network_02_subnet_01
subnet_ip = "10.10.40.0/24"
subnet_region = "us-west1"
subnet_private_access = "false"
subnet_flow_logs = "true"
},
{
subnet_name = "${local.network_02_subnet_02}"
subnet_name = local.network_02_subnet_02
subnet_ip = "10.10.50.0/24"
subnet_region = "us-west1"
subnet_private_access = "false"
Expand All @@ -124,7 +124,7 @@ module "test-vpc-module-02" {
]

secondary_ranges = {
"${local.network_02_subnet_01}" = [
(local.network_02_subnet_01) = [
{
range_name = "${local.network_02_subnet_02}-01"
ip_cidr_range = "192.168.75.0/24"
Expand Down
14 changes: 7 additions & 7 deletions examples/secondary_ranges/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ module "vpc-secondary-ranges" {

subnets = [
{
subnet_name = "${local.subnet_01}"
subnet_name = local.subnet_01
subnet_ip = "10.10.10.0/24"
subnet_region = "us-west1"
},
{
subnet_name = "${local.subnet_02}"
subnet_name = local.subnet_02
subnet_ip = "10.10.20.0/24"
subnet_region = "us-west1"
subnet_private_access = "true"
subnet_flow_logs = "true"
},
{
subnet_name = "${local.subnet_03}"
subnet_name = local.subnet_03
subnet_ip = "10.10.30.0/24"
subnet_region = "us-west1"
subnet_flow_logs = "true"
Expand All @@ -49,14 +49,14 @@ module "vpc-secondary-ranges" {
subnet_flow_logs_metadata = "INCLUDE_ALL_METADATA"
},
{
subnet_name = "${local.subnet_04}"
subnet_name = local.subnet_04
subnet_ip = "10.10.40.0/24"
subnet_region = "us-west1"
},
]

secondary_ranges = {
"${local.subnet_01}" = [
(local.subnet_01) = [
{
range_name = "${local.subnet_01}-01"
ip_cidr_range = "192.168.64.0/24"
Expand All @@ -67,9 +67,9 @@ module "vpc-secondary-ranges" {
},
]

"${local.subnet_02}" = []
(local.subnet_02) = []

"${local.subnet_03}" = [
(local.subnet_03) = [
{
range_name = "${local.subnet_03}-01"
ip_cidr_range = "192.168.66.0/24"
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# [START vpc_custom_create]
module "test-vpc-module" {
source = "terraform-google-modules/network/google"
version = "~> 3.2.0"
version = "~> 4.0.1"
project_id = var.project_id # Replace this with your project ID in quotes
network_name = "my-custom-mode-network"
mtu = 1460
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_project/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ terraform {

required_providers {
google = {
version = "~> 3.45.0"
version = "~> 4.0"
}
null = {
version = "~> 2.1"
Expand Down
3 changes: 3 additions & 0 deletions modules/subnets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ resource "google_compute_subnetwork" "subnetwork" {
)) :
var.secondary_ranges[each.value.subnet_name][i]
]

purpose = lookup(each.value, "purpose", null)
role = lookup(each.value, "role", null)
}

0 comments on commit 8b98a36

Please sign in to comment.