Fixed typo

This commit is contained in:
eliamaldini 2023-08-17 09:37:48 +02:00
parent 77d80a40c3
commit e927bf3858
3 changed files with 39 additions and 28 deletions

View File

@ -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)
<!-- END TOC -->
## 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
```
<!-- TFDOC OPTS files:1 -->
<!-- BEGIN TFDOC -->
## Files
| name | description | resources |
|---|---|---|
| [main.tf](./main.tf) | Module-level locals and resources. | <code>google_vmwareengine_network</code> · <code>google_vmwareengine_private_cloud</code> |
| [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. | <code>string</code> | ✓ | |
| [name](variables.tf#L42) | Private cloud name. | <code>string</code> | ✓ | |
| [project_id](variables.tf#L74) | Project id. | <code>string</code> | ✓ | |
| [zone](variables.tf#L85) | Private cloud zone. | <code>string</code> | ✓ | |
| [zone](variables.tf#L91) | Private cloud zone. | <code>string</code> | ✓ | |
| [description](variables.tf#L17) | Private cloud description. | <code>string</code> | | <code>&#34;Terraform-managed.&#34;</code> |
| [management_cluster_config](variables.tf#L28) | Management cluster configuration. | <code title="object&#40;&#123;&#10; node_type_id &#61; string&#10; node_count &#61; number,&#10; custom_core_count &#61; number&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code title="&#123;&#10; node_type_id &#61; &#34;standard-72&#34;,&#10; node_count &#61; 3,&#10; custom_core_count &#61; null&#10;&#125;">&#123;&#8230;&#125;</code> |
| [private_connections](variables.tf#L47) | VMWare private connections configuration. It is used to create the gcloud command printed as output. | <code title="map&#40;object&#40;&#123;&#10; name &#61; string&#10; description &#61; optional&#40;string, &#34;Terraform-managed.&#34;&#41;&#10; network_self_link &#61; string&#10; peering &#61; string&#10; type &#61; optional&#40;string, &#34;REGIONAL&#34;&#41;&#10; routing_mode &#61; optional&#40;string, &#34;PRIVATE_SERVICE_ACCESS&#34;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [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. | <code>bool</code> | | <code>true</code> |
| [private_connections](variables.tf#L47) | VMWare private connections configuration. It is used to create the gcloud command printed as output. | <code title="map&#40;object&#40;&#123;&#10; name &#61; string&#10; network_self_link &#61; string&#10; peering &#61; string&#10; description &#61; optional&#40;string, &#34;Terraform-managed.&#34;&#41;&#10; type &#61; optional&#40;string, &#34;REGIONAL&#34;&#41;&#10; routing_mode &#61; optional&#40;string, &#34;PRIVATE_SERVICE_ACCESS&#34;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [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. | <code>bool</code> | | <code>true</code> |
| [vmw_network_description](variables.tf#L85) | VMware Engine network description. | <code>string</code> | | <code>&#34;Terraform-managed.&#34;</code> |
## 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. | |
<!-- END TFDOC -->

View File

@ -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
}

View File

@ -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