From e927bf3858a1ec9ff2083f294811ff28d93fca97 Mon Sep 17 00:00:00 2001 From: eliamaldini Date: Thu, 17 Aug 2023 09:37:48 +0200 Subject: [PATCH] Fixed typo --- modules/gcve-private-cloud/README.md | 42 ++++++++++++++----------- modules/gcve-private-cloud/main.tf | 15 ++++----- modules/gcve-private-cloud/variables.tf | 10 ++++-- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/modules/gcve-private-cloud/README.md b/modules/gcve-private-cloud/README.md index 8baad718..ab374c08 100644 --- a/modules/gcve-private-cloud/README.md +++ b/modules/gcve-private-cloud/README.md @@ -1,8 +1,8 @@ # Google Cloud VMWare Engine Private Cloud Module -This module implements the creation and management of a Google Cloud VMWare Engine Private Cloud with its management cluster. If configured, it also creates the vmware engine network or it can work with an existing one. The creation of the private connection with the user VPC requires the execution of the [Google SDK command](https://cloud.google.com/sdk/gcloud/reference/vmware/private-connections/create#--routing-mode) the module provides as an output. +This module implements the creation and management of a Google Cloud VMWare Engine Private Cloud with its management cluster. If configured, it also creates the VMWare engine network or it can work with an existing one. The creation of the private connection with the user VPC requires the execution of the [Google SDK command](https://cloud.google.com/sdk/gcloud/reference/vmware/private-connections/create#--routing-mode) the module provides as an output. -Be aware that the deployment of this module might requires up to 2 hours depending on the selected private cloud target zone. +Be aware that the deployment of this module might require up to 2 hours depending on the selected private cloud target zone. ## TOC @@ -11,14 +11,14 @@ Be aware that the deployment of this module might requires up to 2 hours dependi - [Limitations](#limitations) - [Basic Private Cloud Creation](#basic-private-cloud-creation) - [Private Cloud Creation with custom nodes and cores count](#private-cloud-creation-with-custom-nodes-and-cores-count) -- [Files](#files) - [Variables](#variables) +- [Outputs](#outputs) ## Limitations At the moment this module doesn't support the following use cases: -- `Single node private cloud` -- `Stretched private cloud` +- Single node private cloud +- Stretched private cloud ## Basic Private Cloud Creation @@ -70,18 +70,7 @@ module "gcve-pc" { } # tftest modules=1 resources=2 inventory=custom.yaml ``` - - -## Files - -| name | description | resources | -|---|---|---| -| [main.tf](./main.tf) | Module-level locals and resources. | google_vmwareengine_network · google_vmwareengine_private_cloud | -| [output.tf](./output.tf) | None | | -| [variables.tf](./variables.tf) | Module variables. | | -| [versions.tf](./versions.tf) | Version pins. | | - ## Variables | name | description | type | required | default | @@ -89,9 +78,24 @@ module "gcve-pc" { | [management_cidr](variables.tf#L23) | vSphere/vSAN subnets CIDR range. | string | ✓ | | | [name](variables.tf#L42) | Private cloud name. | string | ✓ | | | [project_id](variables.tf#L74) | Project id. | string | ✓ | | -| [zone](variables.tf#L85) | Private cloud zone. | string | ✓ | | +| [zone](variables.tf#L91) | Private cloud zone. | string | ✓ | | | [description](variables.tf#L17) | Private cloud description. | string | | "Terraform-managed." | | [management_cluster_config](variables.tf#L28) | Management cluster configuration. | object({…}) | | {…} | -| [private_connections](variables.tf#L47) | VMWare private connections configuration. It is used to create the gcloud command printed as output. | map(object({…})) | | {} | -| [vmwareengine_network_create](variables.tf#L79) | Create the VMware Engine network. When set to false, it uses a data source to reference an existing VMware Engine network. | bool | | true | +| [private_connections](variables.tf#L47) | VMWare private connections configuration. It is used to create the gcloud command printed as output. | map(object({…})) | | {} | +| [vmw_network_create](variables.tf#L79) | Create the VMware Engine network. When set to false, it uses a data source to reference an existing VMware Engine network. | bool | | true | +| [vmw_network_description](variables.tf#L85) | VMware Engine network description. | string | | "Terraform-managed." | + +## Outputs + +| name | description | sensitive | +|---|---|:---:| +| [hcx](outputs.tf#L17) | Details about a HCX Cloud Manager appliance. | | +| [id](outputs.tf#L22) | ID of the private cloud | | +| [management_cluster](outputs.tf#L27) | Details of the management cluster of the private cloud | | +| [network_config](outputs.tf#L32) | Details about the network configuration of the private cloud | | +| [nsx](outputs.tf#L37) | Details about a NSX Manager appliance. | | +| [private-cloud](outputs.tf#L42) | The private cloud resource | | +| [private_connections_setup](outputs.tf#L57) | Cloud SDK commands for the private connections manual setup. | | +| [state](outputs.tf#L52) | Details about the state of the private cloud | | +| [vcenter](outputs.tf#L47) | Details about a vCenter Server management appliance. | | diff --git a/modules/gcve-private-cloud/main.tf b/modules/gcve-private-cloud/main.tf index 3f184475..2568f29d 100644 --- a/modules/gcve-private-cloud/main.tf +++ b/modules/gcve-private-cloud/main.tf @@ -16,18 +16,19 @@ locals { region = join("-", slice(split("-", "${var.zone}"), 0, 2)) - vmwareengine_network = ( - var.vmwareengine_network_create + vmw_network = ( + var.vmw_network_create ? try(google_vmwareengine_network.private-cloud-network.0, null) : try(data.google_vmwareengine_network.private-cloud-network.0, null) ) psa_peering = { - for k, v in data.google_compute_network_peering.psa_peering : k => slice(split("/", "${v.peer_network}"), 6, 7)[0] + for k, v in data.google_compute_network_peering.psa_peering : + k => slice(split("/", "${v.peer_network}"), 6, 7)[0] } } data "google_vmwareengine_network" "private-cloud-network" { - count = var.vmwareengine_network_create ? 0 : 1 + count = var.vmw_network_create ? 0 : 1 provider = google-beta project = var.project_id name = "${local.region}-default" @@ -50,7 +51,7 @@ resource "google_vmwareengine_private_cloud" "private-cloud" { network_config { management_cidr = var.management_cidr - vmware_engine_network = local.vmwareengine_network.id + vmware_engine_network = local.vmw_network.id } management_cluster { @@ -64,11 +65,11 @@ resource "google_vmwareengine_private_cloud" "private-cloud" { } resource "google_vmwareengine_network" "private-cloud-network" { - count = var.vmwareengine_network_create ? 1 : 0 + count = var.vmw_network_create ? 1 : 0 provider = google-beta project = var.project_id name = "${local.region}-default" location = local.region type = "LEGACY" - description = "Private cloud ${var.name} network." + description = var.vmw_network_description } diff --git a/modules/gcve-private-cloud/variables.tf b/modules/gcve-private-cloud/variables.tf index 05183e0d..61e5b1d4 100644 --- a/modules/gcve-private-cloud/variables.tf +++ b/modules/gcve-private-cloud/variables.tf @@ -48,9 +48,9 @@ variable "private_connections" { description = "VMWare private connections configuration. It is used to create the gcloud command printed as output." type = map(object({ name = string - description = optional(string, "Terraform-managed.") network_self_link = string peering = string + description = optional(string, "Terraform-managed.") type = optional(string, "REGIONAL") routing_mode = optional(string, "PRIVATE_SERVICE_ACCESS") })) @@ -76,12 +76,18 @@ variable "project_id" { type = string } -variable "vmwareengine_network_create" { +variable "vmw_network_create" { description = "Create the VMware Engine network. When set to false, it uses a data source to reference an existing VMware Engine network." type = bool default = true } +variable "vmw_network_description" { + description = " VMware Engine network description." + type = string + default = "Terraform-managed." +} + variable "zone" { description = "Private cloud zone." type = string