Skip to content

Commit

Permalink
Merge pull request #73 from stevereaver/feature/peeringfix
Browse files Browse the repository at this point in the history
GCVE Peering fixes and feature
  • Loading branch information
umeshkumhar authored Mar 28, 2024
2 parents 6b09067 + 4f37b33 commit 17815e9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
29 changes: 14 additions & 15 deletions modules/gcve-network-peering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ This module contains the terraform to setup and define network connectivity betw
Basic usage of this module is as follows:

```hcl
module "example" {
source = "<module-path>"
module "network-peering" {
source = "github.com/GoogleCloudPlatform/gcve-iac-foundations/modules/gcve-network-peering"
# Required variables
gcve_peer_name =
nw_location =
nw_name =
peer_network_type =
peer_nw_name =
peer_nw_project_id =
project_id =
gcve_peer_name = <gcve peer name in lowercase>
project_id = <name of the project containing VMWARE Engine>
vmware_engine_network_id = <ID of the VMWARE Engine network>
peer_network_type = <peer type>
peer_nw_name = <name of network in peered project>
peer_nw_project_id = <name of project that contains the peered network>
# Optional variables
gcve_peer_description = ""
nw_project_id = "The relative resource project of the VMware Engine network"
gcve_peer_description = <peer description>
peer_export_custom_routes = true
peer_export_custom_routes_with_public_ip = false
peer_import_custom_routes = true
Expand All @@ -52,9 +51,8 @@ module "example" {
|------|-------------|------|---------|:--------:|
| <a name="input_gcve_peer_description"></a> [gcve\_peer\_description](#input\_gcve\_peer\_description) | User-provided description for this network peering. | `string` | `""` | no |
| <a name="input_gcve_peer_name"></a> [gcve\_peer\_name](#input\_gcve\_peer\_name) | The ID of the Network Peering. | `string` | n/a | yes |
| <a name="input_nw_location"></a> [nw\_location](#input\_nw\_location) | The relative resource location of the VMware Engine network | `string` | n/a | yes |
| <a name="input_nw_name"></a> [nw\_name](#input\_nw\_name) | The relative resource name of the VMware Engine network | `string` | n/a | yes |
| <a name="input_nw_project_id"></a> [nw\_project\_id](#input\_nw\_project\_id) | n/a | `string` | `"The relative resource project of the VMware Engine network"` | no |
| <a name="input_vmware_engine_network_id"></a> [vmware\_engine_network_id](#input\_vmware\_engine\_network\_id) | The VMware Engine network id | `string` | n/a | yes |
| <a name="input_nw_project_id"></a> [project\_id](#input\_nw\_project\_id) | The Project ID of the VMWARE Engine Project | `string` | n/a | yes |
| <a name="input_peer_export_custom_routes"></a> [peer\_export\_custom\_routes](#input\_peer\_export\_custom\_routes) | True if custom routes are exported to the peered network; false otherwise. | `bool` | `true` | no |
| <a name="input_peer_export_custom_routes_with_public_ip"></a> [peer\_export\_custom\_routes\_with\_public\_ip](#input\_peer\_export\_custom\_routes\_with\_public\_ip) | True if all subnet routes with a public IP address range are exported; false otherwise | `bool` | `false` | no |
| <a name="input_peer_import_custom_routes"></a> [peer\_import\_custom\_routes](#input\_peer\_import\_custom\_routes) | True if custom routes are imported from the peered network; false otherwise. | `bool` | `true` | no |
Expand All @@ -63,7 +61,8 @@ module "example" {
| <a name="input_peer_nw_location"></a> [peer\_nw\_location](#input\_peer\_nw\_location) | The relative resource location of the network to peer with a standard VMware Engine network. The provided network can be a consumer VPC network or another standard VMware Engine network. | `string` | `"global"` | no |
| <a name="input_peer_nw_name"></a> [peer\_nw\_name](#input\_peer\_nw\_name) | The relative resource name of the network to peer with a standard VMware Engine network. The provided network can be a consumer VPC network or another standard VMware Engine network. | `string` | n/a | yes |
| <a name="input_peer_nw_project_id"></a> [peer\_nw\_project\_id](#input\_peer\_nw\_project\_id) | The relative resource project of the network to peer with a standard VMware Engine network. The provided network can be a consumer VPC network or another standard VMware Engine network. | `string` | n/a | yes |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | he ID of the project in which the resource belongs | `string` | n/a | yes |
| <a name="input_create_remote_peer"></a> [create\_remote\_peer](#create\_remote\_peer) | To automatically create the respective peering in the remote project, set this to true. | `bool` | `false` | no |


## Outputs

Expand Down
14 changes: 14 additions & 0 deletions modules/gcve-network-peering/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,17 @@ resource "google_vmwareengine_network_peering" "peering" {
export_custom_routes_with_public_ip = var.peer_export_custom_routes_with_public_ip
import_custom_routes_with_public_ip = var.peer_import_custom_routes_with_public_ip
}

resource "google_vmwareengine_network_peering" "vmw-engine-network-peering" {
count = var.create_remote_peer == true ? 1 : 0
name = var.gcve_peer_name
description = var.gcve_peer_description
project = var.peer_nw_project_id
vmware_engine_network = var.vmware_engine_network_id
peer_network = local.peer_network
peer_network_type = "STANDARD"
export_custom_routes = var.peer_export_custom_routes
import_custom_routes = var.peer_import_custom_routes
export_custom_routes_with_public_ip = var.peer_export_custom_routes_with_public_ip
import_custom_routes_with_public_ip = var.peer_import_custom_routes_with_public_ip
}
6 changes: 6 additions & 0 deletions modules/gcve-network-peering/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ variable "peer_import_custom_routes_with_public_ip" {
default = false
description = "True if custom routes are imported from the peered network; false otherwise."
}

variable "create_remote_peer" {
type = bool
default = false
description = "True if you would like to create the remote peer in the peered-to project"
}

0 comments on commit 17815e9

Please sign in to comment.