From 110775e8fa6e9854c064fa283282d400818a1359 Mon Sep 17 00:00:00 2001 From: Manuel Morejon Date: Mon, 2 Oct 2023 15:07:37 +0200 Subject: [PATCH] feat: add stack type to peering module Signed-off-by: Manuel Morejon --- modules/network-peering/README.md | 1 + modules/network-peering/main.tf | 4 ++++ modules/network-peering/variables.tf | 6 ++++++ modules/network-peering/versions.tf | 4 ++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/network-peering/README.md b/modules/network-peering/README.md index 847e555a1..c3adad77a 100644 --- a/modules/network-peering/README.md +++ b/modules/network-peering/README.md @@ -56,6 +56,7 @@ module "peering-a-c" { | module\_depends\_on | List of modules or resources this module depends on. | `list(any)` | `[]` | no | | peer\_network | Resource link of the peer network. | `string` | n/a | yes | | prefix | Name prefix for the network peerings | `string` | `"network-peering"` | no | +| stack\_type | Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. Possible values: ["IPV4\_ONLY", "IPV4\_IPV6"]. | `string` | `"IPV4_ONLY"` | no | ## Outputs diff --git a/modules/network-peering/main.tf b/modules/network-peering/main.tf index 7fb49f804..ec55515ec 100644 --- a/modules/network-peering/main.tf +++ b/modules/network-peering/main.tf @@ -42,6 +42,8 @@ resource "google_compute_network_peering" "local_network_peering" { export_subnet_routes_with_public_ip = var.export_local_subnet_routes_with_public_ip import_subnet_routes_with_public_ip = var.export_peer_subnet_routes_with_public_ip + stack_type = var.stack_type + depends_on = [null_resource.module_depends_on] } @@ -56,6 +58,8 @@ resource "google_compute_network_peering" "peer_network_peering" { export_subnet_routes_with_public_ip = var.export_peer_subnet_routes_with_public_ip import_subnet_routes_with_public_ip = var.export_local_subnet_routes_with_public_ip + stack_type = var.stack_type + depends_on = [null_resource.module_depends_on, google_compute_network_peering.local_network_peering] } diff --git a/modules/network-peering/variables.tf b/modules/network-peering/variables.tf index c4b7409db..c3e25bb7c 100644 --- a/modules/network-peering/variables.tf +++ b/modules/network-peering/variables.tf @@ -59,3 +59,9 @@ variable "module_depends_on" { type = list(any) default = [] } + +variable "stack_type" { + description = "Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. Possible values: [\"IPV4_ONLY\", \"IPV4_IPV6\"]." + type = string + default = "IPV4_ONLY" +} diff --git a/modules/network-peering/versions.tf b/modules/network-peering/versions.tf index 0d912f832..c7461aa1a 100644 --- a/modules/network-peering/versions.tf +++ b/modules/network-peering/versions.tf @@ -20,11 +20,11 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "<5.0,>= 2.12" + version = "<5.0,>= 4.65" } google-beta = { source = "hashicorp/google-beta" - version = "<5.0,>= 2.12" + version = "<5.0,>= 4.65" } random = { source = "hashicorp/random"