Skip to content

Commit

Permalink
feat: add stack type to peering module (#500)
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Morejon <[email protected]>
  • Loading branch information
mmorejon authored Oct 3, 2023
1 parent 2d0d6dd commit bc711d2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/network-peering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions modules/network-peering/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}

Expand All @@ -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]
}

Expand Down
6 changes: 6 additions & 0 deletions modules/network-peering/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 2 additions & 2 deletions modules/network-peering/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "<5.0,>= 2.12"
version = ">= 4.65, <5.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "<5.0,>= 2.12"
version = ">= 4.65, <5.0"
}
random = {
source = "hashicorp/random"
Expand Down

0 comments on commit bc711d2

Please sign in to comment.