added the export_public_ip_routes variable in the net-vpc-peering mod… (#1374)

* added the export_public_ip_routes variable in the net-vpc-peering module to control the google_compute_network_peering resource created

* adding period to the variable description
This commit is contained in:
Manuel Aller
2023-05-14 10:29:24 -03:00
committed by GitHub
parent 60d579be4d
commit dd1e5dc463
3 changed files with 24 additions and 15 deletions

View File

@@ -46,12 +46,13 @@ module "peering-a-c" {
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [local_network](variables.tf#L30) | Resource link of the network to add a peering to. | <code>string</code> | ✓ | |
| [peer_network](variables.tf#L41) | Resource link of the peer network. | <code>string</code> | ✓ | |
| [local_network](variables.tf#L36) | Resource link of the network to add a peering to. | <code>string</code> | ✓ | |
| [peer_network](variables.tf#L47) | Resource link of the peer network. | <code>string</code> | ✓ | |
| [export_local_custom_routes](variables.tf#L18) | Export custom routes to peer network from local network. | <code>bool</code> | | <code>false</code> |
| [export_peer_custom_routes](variables.tf#L24) | Export custom routes to local network from peer network. | <code>bool</code> | | <code>false</code> |
| [peer_create_peering](variables.tf#L35) | 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#L46) | Optional name prefix for the network peerings. | <code>string</code> | | <code>null</code> |
| [export_public_ip_routes](variables.tf#L30) | Export subnet routes with public ip. | <code>bool</code> | | <code>true</code> |
| [peer_create_peering](variables.tf#L41) | 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#L52) | Optional name prefix for the network peerings. | <code>string</code> | | <code>null</code> |
## Outputs

View File

@@ -21,20 +21,22 @@ locals {
}
resource "google_compute_network_peering" "local_network_peering" {
name = "${local.prefix}${local.local_network_name}-${local.peer_network_name}"
network = var.local_network
peer_network = var.peer_network
export_custom_routes = var.export_local_custom_routes
import_custom_routes = var.export_peer_custom_routes
name = "${local.prefix}${local.local_network_name}-${local.peer_network_name}"
network = var.local_network
peer_network = var.peer_network
export_custom_routes = var.export_local_custom_routes
import_custom_routes = var.export_peer_custom_routes
export_subnet_routes_with_public_ip = var.export_public_ip_routes
}
resource "google_compute_network_peering" "peer_network_peering" {
count = var.peer_create_peering ? 1 : 0
name = "${local.prefix}${local.peer_network_name}-${local.local_network_name}"
network = var.peer_network
peer_network = var.local_network
export_custom_routes = var.export_peer_custom_routes
import_custom_routes = var.export_local_custom_routes
count = var.peer_create_peering ? 1 : 0
name = "${local.prefix}${local.peer_network_name}-${local.local_network_name}"
network = var.peer_network
peer_network = var.local_network
export_custom_routes = var.export_peer_custom_routes
import_custom_routes = var.export_local_custom_routes
export_subnet_routes_with_public_ip = var.export_public_ip_routes
depends_on = [google_compute_network_peering.local_network_peering]
}

View File

@@ -27,6 +27,12 @@ variable "export_peer_custom_routes" {
default = false
}
variable "export_public_ip_routes" {
description = "Export subnet routes with public ip."
type = bool
default = true
}
variable "local_network" {
description = "Resource link of the network to add a peering to."
type = string