Merge pull request #1833 from GoogleCloudPlatform/cmalpe/vpc-peering-stack-type

Net VPC Peering: added stack_type field
This commit is contained in:
cmalpe 2023-11-01 15:16:02 +05:30 committed by GitHub
commit b8c8393184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -82,6 +82,7 @@ module "peering" {
| [peer_create_peering](variables.tf#L22) | Create the peering on the remote side. If false, only the peering from this network to the remote network is created. | <code>bool</code> | | <code>true</code> |
| [prefix](variables.tf#L33) | Optional name prefix for the network peerings. | <code>string</code> | | <code>null</code> |
| [routes_config](variables.tf#L43) | Control import/export for local and remote peer. Remote configuration is only used when creating remote peering. | <code title="object&#40;&#123;&#10; local &#61; optional&#40;object&#40;&#123;&#10; export &#61; optional&#40;bool, true&#41;&#10; import &#61; optional&#40;bool, true&#41;&#10; public_export &#61; optional&#40;bool&#41;&#10; public_import &#61; optional&#40;bool&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10; peer &#61; optional&#40;object&#40;&#123;&#10; export &#61; optional&#40;bool, true&#41;&#10; import &#61; optional&#40;bool, true&#41;&#10; public_export &#61; optional&#40;bool&#41;&#10; public_import &#61; optional&#40;bool&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> |
| [stack_type](variables.tf#L63) | IP version(s) of traffic and routes that are allowed to be imported or exported between peer networks. Possible values: IPV4_ONLY, IPV4_IPV6. | <code>string</code> | | <code>null</code> |
## Outputs

View File

@ -36,6 +36,7 @@ resource "google_compute_network_peering" "local_network_peering" {
import_subnet_routes_with_public_ip = try(
var.routes_config.local.public_import, null
)
stack_type = var.stack_type
}
resource "google_compute_network_peering" "peer_network_peering" {
@ -55,5 +56,6 @@ resource "google_compute_network_peering" "peer_network_peering" {
import_subnet_routes_with_public_ip = try(
var.routes_config.peer.public_import, null
)
stack_type = var.stack_type
depends_on = [google_compute_network_peering.local_network_peering]
}

View File

@ -59,3 +59,13 @@ variable "routes_config" {
nullable = false
default = {}
}
variable "stack_type" {
description = "IP version(s) of traffic and routes that are allowed to be imported or exported between peer networks. Possible values: IPV4_ONLY, IPV4_IPV6."
type = string
default = null
validation {
condition = var.stack_type == "IPV4_ONLY" || var.stack_type == "IPV4_IPV6" || var.stack_type == null
error_message = "The stack_type must be either 'IPV4_ONLY' or 'IPV4_IPV6'."
}
}