-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from GoogleCloudPlatform/kschieban-cluster
Add module and example for ESXi cluster deployment
- Loading branch information
Showing
9 changed files
with
316 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module "gcve-cluster" { | ||
source = "../../modules/gcve-cluster" | ||
project = var.project | ||
gcve_zone = var.gcve_zone | ||
pc_name = var.pc_name | ||
cluster_name = var.cluster_name | ||
cluster_node_type = var.cluster_node_type | ||
cluster_node_count = var.cluster_node_count | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
output "cluster" { | ||
description = "The cluster resource" | ||
value = module.gcve-cluster.cluster | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
variable "project" { | ||
type = string | ||
description = "Project where private cloud will be deployed" | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
description = "Name of the ESXi cluster." | ||
} | ||
|
||
variable "gcve_zone" { | ||
type = string | ||
description = "Zone of the private cloud" | ||
} | ||
|
||
variable "pc_name" { | ||
type = string | ||
description = "Name of the private cloud that will be deployed" | ||
} | ||
|
||
variable "cluster_node_type" { | ||
type = string | ||
description = "Specify the node type for the management cluster in the private cloud" | ||
default = "standard-72" | ||
} | ||
|
||
variable "cluster_node_count" { | ||
type = number | ||
description = "Specify the number of nodes for the management cluster in the private cloud" | ||
default = 3 | ||
} | ||
|
||
variable "custom_core_count" { | ||
type = number | ||
description = "Specify the number of cores available to each node of the cluster. The value 0 will use the largest amount of available cores on each node in the cluster." | ||
default = 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
terraform { | ||
required_version = ">= 1.3.0" | ||
|
||
required_providers { | ||
google-beta = { | ||
source = "hashicorp/google-beta" | ||
version = ">= 4.71.0" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# GCVE ESXi Cluster module | ||
|
||
This module contains the terraform to deploy an ESXi cluster into a private cloud | ||
|
||
<!-- BEGIN_AUTOMATED_TF_DOCS_BLOCK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 | | ||
| <a name="requirement_google-beta"></a> [google-beta](#requirement\_google-beta) | >= 4.71.0 | | ||
|
||
## Usage | ||
Basic usage of this module is as follows: | ||
|
||
```hcl | ||
module "example" { | ||
source = "<module-path>" | ||
# Required variables | ||
cluster_name = | ||
gcve_zone = | ||
pc_name = | ||
project = | ||
# Optional variables | ||
cluster_node_count = 3 | ||
cluster_node_type = "standard-72" | ||
custom_core_count = 0 | ||
} | ||
``` | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [google-beta_google_vmwareengine_cluster.esxi-cluster](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_vmwareengine_cluster) | resource | | ||
| [google-beta_google_vmwareengine_private_cloud.private_cloud](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/data-sources/google_vmwareengine_private_cloud) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the ESXi cluster. | `string` | n/a | yes | | ||
| <a name="input_cluster_node_count"></a> [cluster\_node\_count](#input\_cluster\_node\_count) | Specify the number of nodes for the management cluster in the private cloud | `number` | `3` | no | | ||
| <a name="input_cluster_node_type"></a> [cluster\_node\_type](#input\_cluster\_node\_type) | Specify the node type for the management cluster in the private cloud | `string` | `"standard-72"` | no | | ||
| <a name="input_custom_core_count"></a> [custom\_core\_count](#input\_custom\_core\_count) | Specify the number of cores available to each node of the cluster. The value 0 will use the largest amount of available cores on each node in the cluster. | `number` | `0` | no | | ||
| <a name="input_gcve_zone"></a> [gcve\_zone](#input\_gcve\_zone) | Zone of the private cloud | `string` | n/a | yes | | ||
| <a name="input_pc_name"></a> [pc\_name](#input\_pc\_name) | Name of the private cloud that will be deployed | `string` | n/a | yes | | ||
| <a name="input_project"></a> [project](#input\_project) | Project where private cloud will be deployed | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_cluster"></a> [cluster](#output\_cluster) | The cluster resource | | ||
|
||
<!-- END_AUTOMATED_TF_DOCS_BLOCK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
data "google_vmwareengine_private_cloud" "private_cloud" { | ||
provider = google-beta | ||
project = var.project | ||
name = var.pc_name | ||
location = var.gcve_zone | ||
} | ||
|
||
resource "google_vmwareengine_cluster" "esxi-cluster" { | ||
provider = google-beta | ||
name = var.cluster_name | ||
parent = data.google_vmwareengine_private_cloud.private_cloud.id | ||
node_type_configs { | ||
node_type_id = var.cluster_node_type | ||
node_count = var.cluster_node_count | ||
custom_core_count = var.custom_core_count | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
output "cluster" { | ||
description = "The cluster resource" | ||
value = google_vmwareengine_cluster.esxi-cluster | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
variable "project" { | ||
type = string | ||
description = "Project where private cloud will be deployed" | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
description = "Name of the ESXi cluster." | ||
} | ||
|
||
variable "gcve_zone" { | ||
type = string | ||
description = "Zone of the private cloud" | ||
} | ||
|
||
variable "pc_name" { | ||
type = string | ||
description = "Name of the private cloud that will be deployed" | ||
} | ||
|
||
variable "cluster_node_type" { | ||
type = string | ||
description = "Specify the node type for the management cluster in the private cloud" | ||
default = "standard-72" | ||
} | ||
|
||
variable "cluster_node_count" { | ||
type = number | ||
description = "Specify the number of nodes for the management cluster in the private cloud" | ||
default = 3 | ||
} | ||
|
||
variable "custom_core_count" { | ||
type = number | ||
description = "Specify the number of cores available to each node of the cluster. The value 0 will use the largest amount of available cores on each node in the cluster." | ||
default = 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
terraform { | ||
required_version = ">= 1.3.0" | ||
|
||
required_providers { | ||
google-beta = { | ||
source = "hashicorp/google-beta" | ||
version = ">= 4.71.0" | ||
} | ||
} | ||
} | ||
|