diff --git a/examples/gcve-network-peering/main.tf b/examples/gcve-network-peering/main.tf
index b772b03..9639c89 100644
--- a/examples/gcve-network-peering/main.tf
+++ b/examples/gcve-network-peering/main.tf
@@ -14,6 +14,12 @@
* limitations under the License.
*/
+data "google_vmwareengine_network" "network-peering-nw" {
+ name = var.nw_name
+ location = var.nw_location
+ project = var.nw_project_id
+}
+
module "gcve_network_peering" {
source = "../../modules/gcve-network-peering"
project_id = var.project_id
@@ -23,9 +29,7 @@ module "gcve_network_peering" {
peer_network_type = var.peer_network_type
# vmware network
- nw_name = var.nw_name
- nw_location = var.nw_location
- nw_project_id = var.nw_project_id
+ vmware_engine_network_id = data.google_vmwareengine_network.network-peering-nw.id
# peer network configs
peer_nw_name = var.peer_nw_name
diff --git a/examples/gcve-private-cloud/main.tf b/examples/gcve-private-cloud/main.tf
index 527c923..0d91041 100644
--- a/examples/gcve-private-cloud/main.tf
+++ b/examples/gcve-private-cloud/main.tf
@@ -17,11 +17,11 @@
module "gcve-private-cloud" {
source = "../../modules/gcve-private-cloud"
project = var.project
- gcve_region = var.gcve_region
gcve_zone = var.gcve_zone
vmware_engine_network_name = var.vmware_engine_network_name
vmware_engine_network_type = var.vmware_engine_network_type
vmware_engine_network_description = var.vmware_engine_network_description
+ vmware_engine_network_location = var.vmware_engine_network_location
create_vmware_engine_network = var.create_vmware_engine_network
pc_name = var.pc_name
pc_cidr_range = var.pc_cidr_range
diff --git a/examples/gcve-private-cloud/variables.tf b/examples/gcve-private-cloud/variables.tf
index eb38dc7..f74a965 100644
--- a/examples/gcve-private-cloud/variables.tf
+++ b/examples/gcve-private-cloud/variables.tf
@@ -18,10 +18,6 @@ variable "project" {
type = string
description = "Project where private cloud will be deployed"
}
-variable "gcve_region" {
- type = string
- description = "Region where private cloud will be deployed"
-}
variable "gcve_zone" {
type = string
description = "Zone where private cloud will be deployed"
@@ -43,6 +39,11 @@ variable "vmware_engine_network_description" {
default = "PC Network"
}
+variable "vmware_engine_network_location" {
+ type = string
+ description = "Location where vmware engine network will be deployed"
+}
+
variable "create_vmware_engine_network" {
type = bool
description = "Set this value to true if you want to create a vmware engine network,"
diff --git a/modules/gcve-network-peering/main.tf b/modules/gcve-network-peering/main.tf
index 20da851..c33670a 100644
--- a/modules/gcve-network-peering/main.tf
+++ b/modules/gcve-network-peering/main.tf
@@ -15,12 +15,6 @@
*/
-data "google_vmwareengine_network" "network-peering-nw" {
- name = var.nw_name
- location = var.nw_location
- project = var.nw_project_id
-}
-
data "google_compute_network" "network-peering-peer-nw" {
count = var.peer_network_type == "STANDARD" ? 1 : 0
name = var.peer_nw_name
@@ -54,7 +48,7 @@ locals {
var.peer_network_type == "DELL_POWERSCALE" ?
"projects/${var.peer_nw_project_id}/global/networks/dellemc-tenant-vpc" :
-
+
"Error: wrong peer network type"
)
}
@@ -63,7 +57,7 @@ resource "google_vmwareengine_network_peering" "peering" {
name = var.gcve_peer_name
description = var.gcve_peer_description
project = var.project_id
- vmware_engine_network = data.google_vmwareengine_network.network-peering-nw.id
+ vmware_engine_network = var.vmware_engine_network_id
peer_network = local.peer_network
peer_network_type = var.peer_network_type
export_custom_routes = var.peer_export_custom_routes
diff --git a/modules/gcve-network-peering/variables.tf b/modules/gcve-network-peering/variables.tf
index d57068d..ec8b2e1 100644
--- a/modules/gcve-network-peering/variables.tf
+++ b/modules/gcve-network-peering/variables.tf
@@ -29,21 +29,11 @@ variable "peer_network_type" {
}
}
-variable "nw_name" {
+variable "vmware_engine_network_id" {
type = string
description = "The relative resource name of the VMware Engine network"
}
-variable "nw_location" {
- type = string
- description = "The relative resource location of the VMware Engine network"
-}
-
-variable "nw_project_id" {
- type = string
- default = "The relative resource project of the VMware Engine network"
-}
-
variable "peer_nw_name" {
type = string
description = " 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."
diff --git a/modules/gcve-private-cloud/README.md b/modules/gcve-private-cloud/README.md
index 707adbe..9e0ce5a 100644
--- a/modules/gcve-private-cloud/README.md
+++ b/modules/gcve-private-cloud/README.md
@@ -20,11 +20,11 @@ module "example" {
# Required variables
cluster_id =
create_vmware_engine_network =
- gcve_region =
gcve_zone =
pc_cidr_range =
pc_name =
project =
+ vmware_engine_network_location =
vmware_engine_network_name =
# Optional variables
@@ -52,13 +52,13 @@ module "example" {
| [cluster\_node\_count](#input\_cluster\_node\_count) | Specify the number of nodes for the management cluster in the private cloud | `number` | `3` | no |
| [cluster\_node\_type](#input\_cluster\_node\_type) | Specify the node type for the management cluster in the private cloud | `string` | `"standard-72"` | no |
| [create\_vmware\_engine\_network](#input\_create\_vmware\_engine\_network) | Set this value to true if you want to create a vmware engine network, | `bool` | n/a | yes |
-| [gcve\_region](#input\_gcve\_region) | Region where private cloud will be deployed | `string` | n/a | yes |
| [gcve\_zone](#input\_gcve\_zone) | Zone where private cloud will be deployed | `string` | n/a | yes |
| [pc\_cidr\_range](#input\_pc\_cidr\_range) | CIDR range for the management network of the private cloud that will be deployed | `string` | n/a | yes |
| [pc\_description](#input\_pc\_description) | Description for the private cloud that will be deployed | `string` | `"Private Cloud description"` | no |
| [pc\_name](#input\_pc\_name) | Name of the private cloud that will be deployed | `string` | n/a | yes |
| [project](#input\_project) | Project where private cloud will be deployed | `string` | n/a | yes |
| [vmware\_engine\_network\_description](#input\_vmware\_engine\_network\_description) | Description of the vmware engine network for the private cloud | `string` | `"PC Network"` | no |
+| [vmware\_engine\_network\_location](#input\_vmware\_engine\_network\_location) | Region where vmware engine network will be deployed | `string` | n/a | yes |
| [vmware\_engine\_network\_name](#input\_vmware\_engine\_network\_name) | Name of the vmware engine network for the private cloud | `string` | n/a | yes |
| [vmware\_engine\_network\_type](#input\_vmware\_engine\_network\_type) | Type of the vmware engine network for the private cloud | `string` | `"LEGACY"` | no |
diff --git a/modules/gcve-private-cloud/main.tf b/modules/gcve-private-cloud/main.tf
index 6677925..53e8ff5 100644
--- a/modules/gcve-private-cloud/main.tf
+++ b/modules/gcve-private-cloud/main.tf
@@ -15,10 +15,11 @@
*/
data "google_vmwareengine_network" "existing_vmware_engine_network" {
+ count = var.create_vmware_engine_network ? 0 : 1
provider = google-beta
project = var.project
name = var.vmware_engine_network_name
- location = var.gcve_region
+ location = var.vmware_engine_network_location
}
resource "google_vmwareengine_network" "vmware_engine_network" {
@@ -26,7 +27,7 @@ resource "google_vmwareengine_network" "vmware_engine_network" {
provider = google-beta
project = var.project
name = var.vmware_engine_network_name
- location = var.gcve_region
+ location = var.vmware_engine_network_location
type = var.vmware_engine_network_type
description = var.vmware_engine_network_description
}
@@ -39,7 +40,7 @@ resource "google_vmwareengine_private_cloud" "gcve_tf_pc" {
description = var.pc_description
network_config {
management_cidr = var.pc_cidr_range
- vmware_engine_network = var.create_vmware_engine_network ? google_vmwareengine_network.vmware_engine_network[0].id : data.google_vmwareengine_network.existing_vmware_engine_network.id
+ vmware_engine_network = var.create_vmware_engine_network ? google_vmwareengine_network.vmware_engine_network[0].id : data.google_vmwareengine_network.existing_vmware_engine_network[0].id
}
management_cluster {
diff --git a/modules/gcve-private-cloud/outputs.tf b/modules/gcve-private-cloud/outputs.tf
index bbd766e..3052c17 100644
--- a/modules/gcve-private-cloud/outputs.tf
+++ b/modules/gcve-private-cloud/outputs.tf
@@ -53,3 +53,8 @@ output "state" {
description = "Details about the state of the private cloud"
value = google_vmwareengine_private_cloud.gcve_tf_pc.state
}
+
+output "network" {
+ description = "Details about the vmware engine network"
+ value = var.create_vmware_engine_network ? google_vmwareengine_network.vmware_engine_network[0].id : data.google_vmwareengine_network.existing_vmware_engine_network[0].id
+}
diff --git a/modules/gcve-private-cloud/variables.tf b/modules/gcve-private-cloud/variables.tf
index a63f1ee..c0b289d 100644
--- a/modules/gcve-private-cloud/variables.tf
+++ b/modules/gcve-private-cloud/variables.tf
@@ -18,10 +18,7 @@ variable "project" {
type = string
description = "Project where private cloud will be deployed"
}
-variable "gcve_region" {
- type = string
- description = "Region where private cloud will be deployed"
-}
+
variable "gcve_zone" {
type = string
description = "Zone where private cloud will be deployed"
@@ -43,6 +40,11 @@ variable "vmware_engine_network_description" {
default = "PC Network"
}
+variable "vmware_engine_network_location" {
+ type = string
+ description = "Location where vmware engine network will be deployed"
+}
+
variable "create_vmware_engine_network" {
type = bool
description = "Set this value to true if you want to create a vmware engine network,"
diff --git a/stages/01-privatecloud/01a-privatecloud/main.tf b/stages/01-privatecloud/01a-privatecloud/main.tf
index cb2b97a..4661597 100644
--- a/stages/01-privatecloud/01a-privatecloud/main.tf
+++ b/stages/01-privatecloud/01a-privatecloud/main.tf
@@ -17,11 +17,11 @@
module "gcve-private-cloud" {
source = "../../../modules/gcve-private-cloud"
project = var.project
- gcve_region = var.gcve_region
gcve_zone = var.gcve_zone
vmware_engine_network_name = var.vmware_engine_network_name
vmware_engine_network_type = var.vmware_engine_network_type
vmware_engine_network_description = var.vmware_engine_network_description
+ vmware_engine_network_location = var.vmware_engine_network_location
create_vmware_engine_network = var.create_vmware_engine_network
pc_name = var.pc_name
pc_cidr_range = var.pc_cidr_range
diff --git a/stages/01-privatecloud/01a-privatecloud/terraform.tfvars.example b/stages/01-privatecloud/01a-privatecloud/terraform.tfvars.example
index 2fd3d6e..5b055c6 100644
--- a/stages/01-privatecloud/01a-privatecloud/terraform.tfvars.example
+++ b/stages/01-privatecloud/01a-privatecloud/terraform.tfvars.example
@@ -1,8 +1,9 @@
project = "my-example-project"
-gcve_region = "asia-southeast1"
gcve_zone = "asia-southeast1-a"
vmware_engine_network_name = "asia-southeast1-default"
vmware_engine_network_description = "my-network-description"
+vmware_engine_network_location = "global"
+vmware_engine_network_type = "STANDARD"
create_vmware_engine_network = true
pc_name = "my-private-cloud"
pc_cidr_range = "10.0.0.0/22"
diff --git a/stages/01-privatecloud/01a-privatecloud/variables.tf b/stages/01-privatecloud/01a-privatecloud/variables.tf
index a63f1ee..f19fa0a 100644
--- a/stages/01-privatecloud/01a-privatecloud/variables.tf
+++ b/stages/01-privatecloud/01a-privatecloud/variables.tf
@@ -18,10 +18,6 @@ variable "project" {
type = string
description = "Project where private cloud will be deployed"
}
-variable "gcve_region" {
- type = string
- description = "Region where private cloud will be deployed"
-}
variable "gcve_zone" {
type = string
description = "Zone where private cloud will be deployed"
@@ -36,6 +32,11 @@ variable "vmware_engine_network_type" {
description = "Type of the vmware engine network for the private cloud"
default = "LEGACY"
}
+variable "vmware_engine_network_location" {
+ type = string
+ description = "Location of the vmware engine network for the private cloud"
+ default = "us-central1"
+}
variable "vmware_engine_network_description" {
type = string
diff --git a/stages/01-privatecloud/01b-network-peering/variables.tf b/stages/01-privatecloud/01b-network-peering/variables.tf
index 8a28e44..9098e9b 100644
--- a/stages/01-privatecloud/01b-network-peering/variables.tf
+++ b/stages/01-privatecloud/01b-network-peering/variables.tf
@@ -97,7 +97,7 @@ variable "peer_import_custom_routes_with_public_ip" {
## dns peering variables
variable "dns_peering" {
- type = bool
+ type = bool
}
variable "dns_name" {