From 5a0f96d367fb414f33ecec182263b7f32bcb300c Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Fri, 31 May 2024 17:05:26 -0400 Subject: [PATCH 01/12] docs: add tf files for the getting started tutorial --- README.md | 2 + .../getting-started-deployment-tf/README.md | 142 +++++ .../cluster_profiles.tf | 485 ++++++++++++++++++ .../getting-started-deployment-tf/clusters.tf | 215 ++++++++ .../getting-started-deployment-tf/data.tf | 173 +++++++ .../getting-started-deployment-tf/inputs.tf | 361 +++++++++++++ .../getting-started-deployment-tf/ippool.tf | 14 + .../manifests/values-3tier.yaml | 20 + .../getting-started-deployment-tf/outputs.tf | 35 ++ .../getting-started-deployment-tf/provider.tf | 34 ++ .../getting-started-deployment-tf/ssh-key.tf | 39 ++ .../terraform.tfvars | 122 +++++ 12 files changed, 1642 insertions(+) create mode 100644 terraform/getting-started-deployment-tf/README.md create mode 100644 terraform/getting-started-deployment-tf/cluster_profiles.tf create mode 100644 terraform/getting-started-deployment-tf/clusters.tf create mode 100644 terraform/getting-started-deployment-tf/data.tf create mode 100644 terraform/getting-started-deployment-tf/inputs.tf create mode 100644 terraform/getting-started-deployment-tf/ippool.tf create mode 100644 terraform/getting-started-deployment-tf/manifests/values-3tier.yaml create mode 100644 terraform/getting-started-deployment-tf/outputs.tf create mode 100644 terraform/getting-started-deployment-tf/provider.tf create mode 100644 terraform/getting-started-deployment-tf/ssh-key.tf create mode 100644 terraform/getting-started-deployment-tf/terraform.tfvars diff --git a/README.md b/README.md index 19806e4..bdbda40 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ The following tutorial code is available: - [vmware-cluster-deployment-tf](./terraform/vmware-cluster-deployment-tf/README.md) - Learn how to deploy a VMware cluster and the Hello Universe application as a part of the Deploy App Workloads with a PCG tutorial. [Link](https://docs.spectrocloud.com/clusters/pcg/deploy-app-pcg) +- [getting-started-deployment-tf](./terraform/getting-started-deployment-tf/README.md) - Learn how to deploy and update a cluster to AWS, Azure, GCP, and VMware vSphere with Palette. [Link](https://docs.spectrocloud.com/getting-started/terraform) + ## Docker All the tutorials are available in a Docker image that you can use to get started with the tutorials. diff --git a/terraform/getting-started-deployment-tf/README.md b/terraform/getting-started-deployment-tf/README.md new file mode 100644 index 0000000..9714489 --- /dev/null +++ b/terraform/getting-started-deployment-tf/README.md @@ -0,0 +1,142 @@ +# IaaS Cluster Deployment + +This Terraform code is explained in the [Deploy a Cluster](https://docs.spectrocloud.com/clusters/public-cloud/deploy-k8s-cluster) tutorial. + +This Terraform code has three main toggle variables that you can use to deploy to one of the following cloud providers. + +| Variable | Provider | Description | Default | +| -------------- | -------- | ------------------------------------ | ------- | +| `deploy-aws` | AWS | Enable to deploy a cluster to AWS. | `false` | +| `deploy-azure` | GCP | Enable to deploy a cluster to Azure. | `false` | +| `deploy-gcp` | Azure | Enable to deploy a cluster to GCP. | `false` | + +> You can enable as many of the providers as you want. You just need to ensure all provider's required values are specified. + +To get started, open up the file **terraform.tfvars**. Toggle the provider variable mentioned in the table and start providing values for the respective cloud provider. Make sure you specify a value to your cloud provider variables and replace all values containing the string `REPLACE ME`. + +## Requirements + +| Name | Version | +| --------------------------------------------------------------------------------- | ------------- | +| [terraform](#requirement_terraform) | >= 1.5 | +| [local](#requirement_local) | 2.4.1 | +| [spectrocloud](#requirement_spectrocloud) | >= 0.19.0-pre | +| [tls](#requirement_tls) | 4.0.4 | +| [vsphere](#requirement_vsphere) | >= 2.6.1 | + +## Providers + +| Name | Version | +| --------------------------------------------------------------------------- | ------- | +| [local](#provider_local) | 2.4.1 | +| [spectrocloud](#provider_spectrocloud) | 0.19.2 | +| [tls](#provider_tls) | 4.0.4 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | +| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | +| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | +| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | +| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | +| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | +| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.aws-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | +| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | +| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | +| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | +| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | +| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +| ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | +| [app_namespace](#input_app_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes | +| [app_port](#input_app_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes | +| [auth_token](#input_auth_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes | +| [aws-cloud-account-name](#input_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | `""` | no | +| [aws-key-pair-name](#input_aws-key-pair-name) | The name of the AWS key pair to use for SSH access to the cluster. | `string` | `""` | no | +| [aws-region](#input_aws-region) | AWS region | `string` | `"us-east-1"` | no | +| [aws_control_plane_nodes](#input_aws_control_plane_nodes) | AWS control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [aws_worker_nodes](#input_aws_worker_nodes) | AWS worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [azure-cloud-account-name](#input_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no | +| [azure-region](#input_azure-region) | Azure region. | `string` | `"eastus"` | no | +| [azure-use-azs](#input_azure-use-azs) | A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource. | `bool` | n/a | yes | +| [azure_control_plane_nodes](#input_azure_control_plane_nodes) | Azure control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [azure_resource_group](#input_azure_resource_group) | Azure resource group. | `string` | `""` | no | +| [azure_subscription_id](#input_azure_subscription_id) | Azure subscription ID. | `string` | `""` | no | +| [azure_worker_nodes](#input_azure_worker_nodes) | Azure worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [datacenter_name](#input_datacenter_name) | The name of the datacenter in vSphere.. | `string` | n/a | yes | +| [datastore_name](#input_datastore_name) | The name of the vSphere datastore. | `string` | n/a | yes | +| [db_password](#input_db_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | +| [deploy-aws](#input_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | +| [deploy-aws-new](#input_deploy-aws-new) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | +| [deploy-azure](#input_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | +| [deploy-azure-new](#input_deploy-azure-new) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | +| [deploy-gcp](#input_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | +| [deploy-gcp-new](#input_deploy-gcp-new) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware](#input_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | +| [deploy-vmware-new](#input_deploy-vmware-new) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | +| [folder_name](#input_folder_name) | The name of the folder in vSphere. | `string` | n/a | yes | +| [gcp-cloud-account-name](#input_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | +| [gcp-region](#input_gcp-region) | GCP region | `string` | `"us-central1"` | no | +| [gcp_control_plane_nodes](#input_gcp_control_plane_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [gcp_project_name](#input_gcp_project_name) | The name of your GCP project. | `string` | `""` | no | +| [gcp_worker_nodes](#input_gcp_worker_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [metallb_ip](#input_metallb_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | +| [network_name](#input_network_name) | The name of the vSphere network. | `string` | n/a | yes | +| [pcg_name](#input_pcg_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | +| [replicas_number](#input_replicas_number) | The number of pods to be created. | `number` | n/a | yes | +| [resource_pool_name](#input_resource_pool_name) | The name of the vSphere resource pool. | `string` | n/a | yes | +| [search_domain](#input_search_domain) | The name of network search domain. | `string` | n/a | yes | +| [ssh_key](#input_ssh_key) | The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [ssh_key_private](#input_ssh_key_private) | The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [tags](#input_tags) | The default tags to apply to Palette resources. | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"repository:spectrocloud:tutorials",
"terraform_managed:true",
"tutorial:getting-started-terraform"
]
| no | +| [vsphere_cluster](#input_vsphere_cluster) | The name of your vSphere cluster. | `string` | n/a | yes | + +## Outputs + +| Name | Description | +| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | +| [Advisory](#output_Advisory) | n/a | +| [ssh_connection_command](#output_ssh_connection_command) | Command to use the generated private SSH key to access the nodes. | +| [ssh_connection_command_user](#output_ssh_connection_command_user) | Command to use the user's private SSH key to access the nodes. | +| [ssh_key_location](#output_ssh_key_location) | Location of the generated private SSH key file. | +| [ssh_public_key_location](#output_ssh_public_key_location) | Location of the generated public SSH key file. | + + diff --git a/terraform/getting-started-deployment-tf/cluster_profiles.tf b/terraform/getting-started-deployment-tf/cluster_profiles.tf new file mode 100644 index 0000000..5fa635c --- /dev/null +++ b/terraform/getting-started-deployment-tf/cluster_profiles.tf @@ -0,0 +1,485 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +############################ +# AWS Cluster Profile v1.0.0 +############################ +resource "spectrocloud_cluster_profile" "aws-profile" { + count = var.deploy-aws ? 1 : 0 + + name = "tf-aws-profile" + description = "A basic cluster profile for AWS" + tags = concat(var.tags, ["env:aws"]) + cloud = "aws" + type = "cluster" + version = "1.0.0" + + pack { + name = data.spectrocloud_pack.aws_ubuntu.name + tag = data.spectrocloud_pack.aws_ubuntu.version + uid = data.spectrocloud_pack.aws_ubuntu.id + values = data.spectrocloud_pack.aws_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.aws_k8s.name + tag = data.spectrocloud_pack.aws_k8s.version + uid = data.spectrocloud_pack.aws_k8s.id + values = data.spectrocloud_pack.aws_k8s.values + } + + pack { + name = data.spectrocloud_pack.aws_cni.name + tag = data.spectrocloud_pack.aws_cni.version + uid = data.spectrocloud_pack.aws_cni.id + values = data.spectrocloud_pack.aws_cni.values + } + + pack { + name = data.spectrocloud_pack.aws_csi.name + tag = data.spectrocloud_pack.aws_csi.version + uid = data.spectrocloud_pack.aws_csi.id + values = data.spectrocloud_pack.aws_csi.values + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number + db_password = var.db_password, + auth_token = var.auth_token + }) + } +} + +############################ +# AWS Cluster Profile v1.1.0 +############################ +resource "spectrocloud_cluster_profile" "aws-profile-new" { + count = var.deploy-aws-new ? 1 : 0 + + name = "tf-aws-profile" + description = "A basic cluster profile for AWS with Kubecost" + tags = concat(var.tags, ["env:aws"]) + cloud = "aws" + type = "cluster" + version = "1.1.0" + + pack { + name = data.spectrocloud_pack.aws_ubuntu.name + tag = data.spectrocloud_pack.aws_ubuntu.version + uid = data.spectrocloud_pack.aws_ubuntu.id + values = data.spectrocloud_pack.aws_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.aws_k8s.name + tag = data.spectrocloud_pack.aws_k8s.version + uid = data.spectrocloud_pack.aws_k8s.id + values = data.spectrocloud_pack.aws_k8s.values + } + + pack { + name = data.spectrocloud_pack.aws_cni.name + tag = data.spectrocloud_pack.aws_cni.version + uid = data.spectrocloud_pack.aws_cni.id + values = data.spectrocloud_pack.aws_cni.values + } + + pack { + name = data.spectrocloud_pack.aws_csi.name + tag = data.spectrocloud_pack.aws_csi.version + uid = data.spectrocloud_pack.aws_csi.id + values = data.spectrocloud_pack.aws_csi.values + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number + db_password = var.db_password, + auth_token = var.auth_token + }) + } + + pack { + name = data.spectrocloud_pack.kubecost.name + tag = data.spectrocloud_pack.kubecost.version + uid = data.spectrocloud_pack.kubecost.id + values = data.spectrocloud_pack.kubecost.values + } +} + +############################## +# Azure Cluster Profile v1.0.0 +############################## +resource "spectrocloud_cluster_profile" "azure-profile" { + count = var.deploy-azure ? 1 : 0 + + name = "tf-azure-profile" + description = "A basic cluster profile for Azure" + tags = concat(var.tags, ["env:azure"]) + cloud = "azure" + type = "cluster" + version = "1.0.0" + + pack { + name = data.spectrocloud_pack.azure_ubuntu.name + tag = data.spectrocloud_pack.azure_ubuntu.version + uid = data.spectrocloud_pack.azure_ubuntu.id + values = data.spectrocloud_pack.azure_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.azure_k8s.name + tag = data.spectrocloud_pack.azure_k8s.version + uid = data.spectrocloud_pack.azure_k8s.id + values = data.spectrocloud_pack.azure_k8s.values + } + + pack { + name = data.spectrocloud_pack.azure_cni.name + tag = data.spectrocloud_pack.azure_cni.version + uid = data.spectrocloud_pack.azure_cni.id + values = data.spectrocloud_pack.azure_cni.values + } + + pack { + name = data.spectrocloud_pack.azure_csi.name + tag = data.spectrocloud_pack.azure_csi.version + uid = data.spectrocloud_pack.azure_csi.id + values = data.spectrocloud_pack.azure_csi.values + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number + db_password = var.db_password, + auth_token = var.auth_token + }) + } +} + +############################## +# Azure Cluster Profile v1.1.0 +############################## +resource "spectrocloud_cluster_profile" "azure-profile-new" { + count = var.deploy-azure-new ? 1 : 0 + + name = "tf-azure-profile" + description = "A basic cluster profile for Azure with Kubecost" + tags = concat(var.tags, ["env:azure"]) + cloud = "azure" + type = "cluster" + version = "1.1.0" + + pack { + name = data.spectrocloud_pack.azure_ubuntu.name + tag = data.spectrocloud_pack.azure_ubuntu.version + uid = data.spectrocloud_pack.azure_ubuntu.id + values = data.spectrocloud_pack.azure_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.azure_k8s.name + tag = data.spectrocloud_pack.azure_k8s.version + uid = data.spectrocloud_pack.azure_k8s.id + values = data.spectrocloud_pack.azure_k8s.values + } + + pack { + name = data.spectrocloud_pack.azure_cni.name + tag = data.spectrocloud_pack.azure_cni.version + uid = data.spectrocloud_pack.azure_cni.id + values = data.spectrocloud_pack.azure_cni.values + } + + pack { + name = data.spectrocloud_pack.azure_csi.name + tag = data.spectrocloud_pack.azure_csi.version + uid = data.spectrocloud_pack.azure_csi.id + values = data.spectrocloud_pack.azure_csi.values + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number + db_password = var.db_password, + auth_token = var.auth_token + }) + } + + pack { + name = data.spectrocloud_pack.kubecost.name + tag = data.spectrocloud_pack.kubecost.version + uid = data.spectrocloud_pack.kubecost.id + values = data.spectrocloud_pack.kubecost.values + } +} + + +############################ +# GCP Cluster Profile v1.0.0 +############################ +resource "spectrocloud_cluster_profile" "gcp-profile" { + count = var.deploy-gcp ? 1 : 0 + + name = "tf-gcp-profile" + description = "A basic cluster profile for GCP" + tags = concat(var.tags, ["env:GCP"]) + cloud = "gcp" + type = "cluster" + version = "1.0.0" + + pack { + name = data.spectrocloud_pack.gcp_ubuntu.name + tag = data.spectrocloud_pack.gcp_ubuntu.version + uid = data.spectrocloud_pack.gcp_ubuntu.id + values = data.spectrocloud_pack.gcp_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.gcp_k8s.name + tag = data.spectrocloud_pack.gcp_k8s.version + uid = data.spectrocloud_pack.gcp_k8s.id + values = data.spectrocloud_pack.gcp_k8s.values + } + + pack { + name = data.spectrocloud_pack.gcp_cni.name + tag = data.spectrocloud_pack.gcp_cni.version + uid = data.spectrocloud_pack.gcp_cni.id + values = data.spectrocloud_pack.gcp_cni.values + } + + pack { + name = data.spectrocloud_pack.gcp_csi.name + tag = data.spectrocloud_pack.gcp_csi.version + uid = data.spectrocloud_pack.gcp_csi.id + values = data.spectrocloud_pack.gcp_csi.values + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number + db_password = var.db_password, + auth_token = var.auth_token + }) + } +} + +############################ +# GCP Cluster Profile v1.1.0 +############################ +resource "spectrocloud_cluster_profile" "gcp-profile-new" { + count = var.deploy-gcp-new ? 1 : 0 + + name = "tf-gcp-profile" + description = "A basic cluster profile for GCP with Kubecost" + tags = concat(var.tags, ["env:GCP"]) + cloud = "gcp" + type = "cluster" + version = "1.1.0" + + pack { + name = data.spectrocloud_pack.gcp_ubuntu.name + tag = data.spectrocloud_pack.gcp_ubuntu.version + uid = data.spectrocloud_pack.gcp_ubuntu.id + values = data.spectrocloud_pack.gcp_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.gcp_k8s.name + tag = data.spectrocloud_pack.gcp_k8s.version + uid = data.spectrocloud_pack.gcp_k8s.id + values = data.spectrocloud_pack.gcp_k8s.values + } + + pack { + name = data.spectrocloud_pack.gcp_cni.name + tag = data.spectrocloud_pack.gcp_cni.version + uid = data.spectrocloud_pack.gcp_cni.id + values = data.spectrocloud_pack.gcp_cni.values + } + + pack { + name = data.spectrocloud_pack.gcp_csi.name + tag = data.spectrocloud_pack.gcp_csi.version + uid = data.spectrocloud_pack.gcp_csi.id + values = data.spectrocloud_pack.gcp_csi.values + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number, + db_password = var.db_password, + auth_token = var.auth_token + }) + } + + pack { + name = data.spectrocloud_pack.kubecost.name + tag = data.spectrocloud_pack.kubecost.version + uid = data.spectrocloud_pack.kubecost.id + values = data.spectrocloud_pack.kubecost.values + } +} + +################################ +# VMware Cluster Profile v.1.0.0 +################################ +resource "spectrocloud_cluster_profile" "vmware-profile" { + count = var.deploy-vmware ? 1 : 0 + + name = "tf-vmware-profile" + description = "A basic cluster profile for VMware" + tags = concat(var.tags, ["env:VMware"]) + cloud = "vsphere" + type = "cluster" + version = "1.0.0" + + pack { + name = data.spectrocloud_pack.vmware_ubuntu.name + tag = data.spectrocloud_pack.vmware_ubuntu.version + uid = data.spectrocloud_pack.vmware_ubuntu.id + values = data.spectrocloud_pack.vmware_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.vmware_k8s.name + tag = data.spectrocloud_pack.vmware_k8s.version + uid = data.spectrocloud_pack.vmware_k8s.id + values = data.spectrocloud_pack.vmware_k8s.values + } + + pack { + name = data.spectrocloud_pack.vmware_cni.name + tag = data.spectrocloud_pack.vmware_cni.version + uid = data.spectrocloud_pack.vmware_cni.id + values = data.spectrocloud_pack.vmware_cni.values + } + + pack { + name = data.spectrocloud_pack.vmware_csi.name + tag = data.spectrocloud_pack.vmware_csi.version + uid = data.spectrocloud_pack.vmware_csi.id + values = data.spectrocloud_pack.vmware_csi.values + } + + pack { + name = data.spectrocloud_pack.vmware_metallb.name + tag = data.spectrocloud_pack.vmware_metallb.version + uid = data.spectrocloud_pack.vmware_metallb.id + values = replace(data.spectrocloud_pack.vmware_metallb.values, "192.168.10.0/24", var.metallb_ip) + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number, + db_password = var.db_password, + auth_token = var.auth_token + }) + } +} + +############################### +# VMware Cluster Profile v1.1.0 +############################### +resource "spectrocloud_cluster_profile" "vmware-profile-new" { + count = var.deploy-vmware-new ? 1 : 0 + + name = "tf-vmware-profile" + description = "A basic cluster profile for VMware with Kubecost" + tags = concat(var.tags, ["env:VMware"]) + cloud = "vsphere" + type = "cluster" + version = "1.1.0" + + pack { + name = data.spectrocloud_pack.vmware_ubuntu.name + tag = data.spectrocloud_pack.vmware_ubuntu.version + uid = data.spectrocloud_pack.vmware_ubuntu.id + values = data.spectrocloud_pack.vmware_ubuntu.values + } + + pack { + name = data.spectrocloud_pack.vmware_k8s.name + tag = data.spectrocloud_pack.vmware_k8s.version + uid = data.spectrocloud_pack.vmware_k8s.id + values = data.spectrocloud_pack.vmware_k8s.values + } + + pack { + name = data.spectrocloud_pack.vmware_cni.name + tag = data.spectrocloud_pack.vmware_cni.version + uid = data.spectrocloud_pack.vmware_cni.id + values = data.spectrocloud_pack.vmware_cni.values + } + + pack { + name = data.spectrocloud_pack.vmware_csi.name + tag = data.spectrocloud_pack.vmware_csi.version + uid = data.spectrocloud_pack.vmware_csi.id + values = data.spectrocloud_pack.vmware_csi.values + } + + pack { + name = data.spectrocloud_pack.vmware_metallb.name + tag = data.spectrocloud_pack.vmware_metallb.version + uid = data.spectrocloud_pack.vmware_metallb.id + values = replace(data.spectrocloud_pack.vmware_metallb.values, "192.168.10.0/24", var.metallb_ip) + } + + pack { + name = data.spectrocloud_pack.hellouniverse.name + tag = data.spectrocloud_pack.hellouniverse.version + uid = data.spectrocloud_pack.hellouniverse.id + values = templatefile("manifests/values-3tier.yaml", { + namespace = var.app_namespace, + port = var.app_port, + replicas = var.replicas_number, + db_password = var.db_password, + auth_token = var.auth_token + }) + } + + pack { + name = data.spectrocloud_pack.kubecost.name + tag = data.spectrocloud_pack.kubecost.version + uid = data.spectrocloud_pack.kubecost.id + values = data.spectrocloud_pack.kubecost.values + } +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/clusters.tf b/terraform/getting-started-deployment-tf/clusters.tf new file mode 100644 index 0000000..972c855 --- /dev/null +++ b/terraform/getting-started-deployment-tf/clusters.tf @@ -0,0 +1,215 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +############# +# AWS Cluster +############# +resource "spectrocloud_cluster_aws" "aws-cluster" { + count = var.deploy-aws ? 1 : 0 + + name = "aws-cluster" + tags = concat(var.tags, ["env:aws"]) + cloud_account_id = data.spectrocloud_cloudaccount_aws.account[0].id + + cloud_config { + region = var.aws-region + ssh_key_name = var.aws-key-pair-name + } + + cluster_profile { + id = spectrocloud_cluster_profile.aws-profile[0].id + #id = spectrocloud_cluster_profile.aws-profile-new[0].id + } + + machine_pool { + control_plane = true + control_plane_as_worker = true + name = "control-plane-pool" + count = var.aws_control_plane_nodes.count + instance_type = var.aws_control_plane_nodes.instance_type + disk_size_gb = var.aws_control_plane_nodes.disk_size_gb + azs = var.aws_control_plane_nodes.availability_zones + } + + machine_pool { + name = "worker-pool" + count = var.aws_worker_nodes.count + instance_type = var.aws_worker_nodes.instance_type + disk_size_gb = var.aws_worker_nodes.disk_size_gb + azs = var.aws_worker_nodes.availability_zones + } + + timeouts { + create = "30m" + delete = "15m" + } +} +############### +# Azure Cluster +############### +resource "spectrocloud_cluster_azure" "azure-cluster" { + count = var.deploy-azure ? 1 : 0 + + name = "azure-cluster" + tags = concat(var.tags, ["env:azure"]) + cloud_account_id = data.spectrocloud_cloudaccount_azure.account[0].id + + cloud_config { + subscription_id = var.azure_subscription_id + resource_group = var.azure_resource_group + region = var.azure-region + ssh_key = tls_private_key.tutorial_ssh_key_azure[0].public_key_openssh + } + + cluster_profile { + #id = spectrocloud_cluster_profile.azure-profile[0].id + id = spectrocloud_cluster_profile.azure-profile-new[0].id + } + + machine_pool { + control_plane = true + control_plane_as_worker = true + name = "control-plane-pool" + count = var.azure_control_plane_nodes.count + instance_type = var.azure_control_plane_nodes.instance_type + azs = var.azure_control_plane_nodes.azs + is_system_node_pool = var.azure_control_plane_nodes.is_system_node_pool + disk { + size_gb = var.azure_control_plane_nodes.disk_size_gb + type = "Standard_LRS" + } + } + + machine_pool { + name = "worker-basic" + count = var.azure_worker_nodes.count + instance_type = var.azure_worker_nodes.instance_type + azs = var.azure_worker_nodes.azs + is_system_node_pool = var.azure_worker_nodes.is_system_node_pool + } + + timeouts { + create = "30m" + delete = "15m" + } +} + +############# +# GCP Cluster +############# +resource "spectrocloud_cluster_gcp" "gcp-cluster" { + count = var.deploy-gcp ? 1 : 0 + + name = "gcp-cluster" + tags = concat(var.tags, ["env:gcp"]) + cloud_account_id = data.spectrocloud_cloudaccount_gcp.account[0].id + + cloud_config { + project = var.gcp_project_name + region = var.gcp-region + } + + cluster_profile { + id = spectrocloud_cluster_profile.gcp-profile[0].id + #id = spectrocloud_cluster_profile.gcp-profile-new[0].id + } + + machine_pool { + control_plane = true + control_plane_as_worker = true + name = "control-plane-pool" + count = var.gcp_control_plane_nodes.count + instance_type = var.gcp_control_plane_nodes.instance_type + disk_size_gb = var.gcp_control_plane_nodes.disk_size_gb + azs = var.gcp_control_plane_nodes.availability_zones + } + + machine_pool { + name = "worker-pool" + count = var.gcp_worker_nodes.count + instance_type = var.gcp_worker_nodes.instance_type + disk_size_gb = var.gcp_worker_nodes.disk_size_gb + azs = var.gcp_worker_nodes.availability_zones + } + + timeouts { + create = "30m" + delete = "15m" + } +} + +################ +# VMware Cluster +################ + +resource "spectrocloud_cluster_vsphere" "vmware-cluster" { + count = var.deploy-vmware ? 1 : 0 + + name = "vmware-cluster" + tags = concat(var.tags, ["env:vmware"]) + cloud_account_id = data.spectrocloud_cloudaccount_vsphere.account[0].id + + cloud_config { + ssh_key = local.ssh_public_key + datacenter = var.datacenter_name + folder = var.folder_name + static_ip = false # If true, the cluster will use static IP placement. If false, the cluster will use DDNS. + network_search_domain = var.search_domain + } + + cluster_profile { + id = spectrocloud_cluster_profile.vmware-profile[0].id + #id = spectrocloud_cluster_profile.vmware-profile-new[0].id + } + + scan_policy { + configuration_scan_schedule = "0 0 * * SUN" + penetration_scan_schedule = "0 0 * * SUN" + conformance_scan_schedule = "0 0 1 * *" + } + + machine_pool { + name = "control-plane-pool" + count = 1 + control_plane = true + control_plane_as_worker = true + + instance_type { + cpu = 4 + disk_size_gb = 60 + memory_mb = 8000 + } + + placement { + cluster = var.vsphere_cluster + datastore = var.datastore_name + network = var.network_name + resource_pool = var.resource_pool_name + # Required for static IP placement. + #static_ip_pool_id = resource.spectrocloud_privatecloudgateway_ippool.ippool.id + } + + } + + machine_pool { + name = "worker-pool" + count = 1 + control_plane = false + + instance_type { + cpu = 4 + disk_size_gb = 60 + memory_mb = 8000 + } + + placement { + cluster = var.vsphere_cluster + datastore = var.datastore_name + network = var.network_name + resource_pool = var.resource_pool_name + # Required for static IP placement. + #static_ip_pool_id = resource.spectrocloud_privatecloudgateway_ippool.ippool.id + } + } + +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/data.tf b/terraform/getting-started-deployment-tf/data.tf new file mode 100644 index 0000000..8a1e2ce --- /dev/null +++ b/terraform/getting-started-deployment-tf/data.tf @@ -0,0 +1,173 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +######################################## +# Data resources for the cluster profile +######################################## +data "spectrocloud_registry" "public_registry" { + name = "Public Repo" +} + +data "spectrocloud_registry" "community_registry" { + name = "Palette Community Registry" +} + +############# +# AWS +############# +data "spectrocloud_cloudaccount_aws" "account" { + count = var.deploy-aws ? 1 : 0 + name = var.aws-cloud-account-name +} + +data "spectrocloud_pack" "aws_csi" { + name = "csi-aws-ebs" + version = "1.26.1" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "aws_cni" { + name = "cni-calico" + version = "3.27.0" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "aws_k8s" { + name = "kubernetes" + version = "1.29.0" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "aws_ubuntu" { + name = "ubuntu-aws" + version = "22.04" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +############# +# Azure +############# +data "spectrocloud_cloudaccount_azure" "account" { + count = var.deploy-azure ? 1 : 0 + name = var.azure-cloud-account-name +} + +data "spectrocloud_pack" "azure_csi" { + name = "csi-azure" + version = "1.28.3" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "azure_cni" { + name = "cni-calico-azure" + version = "3.26.1" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "azure_k8s" { + name = "kubernetes" + version = "1.27.5" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "azure_ubuntu" { + name = "ubuntu-azure" + version = "22.04" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +############# +# GCP +############# +data "spectrocloud_cloudaccount_gcp" "account" { + count = var.deploy-gcp ? 1 : 0 + name = var.gcp-cloud-account-name +} + +data "spectrocloud_pack" "gcp_csi" { + name = "csi-gcp-driver" + version = "1.12.4" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "gcp_cni" { + name = "cni-calico" + version = "3.27.0" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "gcp_k8s" { + name = "kubernetes" + version = "1.28.3" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "gcp_ubuntu" { + name = "ubuntu-gcp" + version = "22.04" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +############# +# VMware +############# + +data "spectrocloud_cloudaccount_vsphere" "account" { + count = var.deploy-vmware ? 1 : 0 + name = var.pcg_name +} + +data "spectrocloud_pack" "vmware_ubuntu" { + name = "ubuntu-vsphere" + version = "22.04" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "vmware_k8s" { + name = "kubernetes" + version = "1.28.3" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "vmware_cni" { + name = "cni-calico" + version = "3.26.3" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "vmware_csi" { + name = "csi-vsphere-csi" + version = "3.0.2" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +data "spectrocloud_pack" "vmware_metallb" { + name = "lb-metallb-helm" + version = "0.13.11" + registry_uid = data.spectrocloud_registry.public_registry.id +} + +# Required for static IP placement +# data "spectrocloud_private_cloud_gateway" "pcg" { +# name = var.pcg_name +# } + +##################### +# Hello Universe Pack +##################### + +data "spectrocloud_pack" "hellouniverse" { + name = "hello-universe" + version = "1.1.2" + registry_uid = data.spectrocloud_registry.community_registry.id +} + +##################### +# Kubecost Pack +##################### + +data "spectrocloud_pack" "kubecost" { + name = "cost-analyzer" + version = "1.103.3" + registry_uid = data.spectrocloud_registry.community_registry.id +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/inputs.tf b/terraform/getting-started-deployment-tf/inputs.tf new file mode 100644 index 0000000..ac570ad --- /dev/null +++ b/terraform/getting-started-deployment-tf/inputs.tf @@ -0,0 +1,361 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +####### +# AWS +####### +variable "aws-cloud-account-name" { + type = string + description = "The name of your AWS account as assigned in Palette." + default = "" +} + +variable "deploy-aws" { + type = bool + description = "A flag for enabling a deployment on AWS." +} + +variable "deploy-aws-new" { + type = bool + description = "A flag for enabling a deployment on AWS with Kubecost." +} + +variable "aws-region" { + type = string + description = "AWS region" + default = "us-east-1" +} + +variable "aws-key-pair-name" { + type = string + description = "The name of the AWS key pair to use for SSH access to the cluster." + default = "" +} + +variable "aws_control_plane_nodes" { + type = object({ + count = string + control_plane = bool + instance_type = string + disk_size_gb = string + availability_zones = list(string) + }) + default = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1a"] + } + description = "AWS control plane nodes configuration." +} +variable "aws_worker_nodes" { + type = object({ + count = string + control_plane = bool + instance_type = string + disk_size_gb = string + availability_zones = list(string) + }) + default = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1a"] + } + description = "AWS worker nodes configuration." +} + +####### +# Azure +####### +variable "azure-cloud-account-name" { + type = string + description = "The name of your Azure account as assigned in Palette." + default = "" +} + +variable "deploy-azure" { + type = bool + description = "A flag for enabling a deployment on Azure." +} + +variable "deploy-azure-new" { + type = bool + description = "A flag for enabling a deployment on Azure with Kubecost." +} + +variable "azure_subscription_id" { + type = string + description = "Azure subscription ID." + default = "" +} + +variable "azure_resource_group" { + type = string + description = "Azure resource group." + default = "" +} + +variable "azure-use-azs" { + type = bool + description = "A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource." +} + +variable "azure-region" { + type = string + description = "Azure region." + default = "eastus" +} + +variable "azure_control_plane_nodes" { + type = object({ + count = string + control_plane = bool + instance_type = string + disk_size_gb = string + azs = list(string) + is_system_node_pool = bool + }) + default = { + count = "1" + control_plane = true + instance_type = "Standard_A8_v2" + disk_size_gb = "60" + azs = ["1"] + is_system_node_pool = false } + description = "Azure control plane nodes configuration." +} + +variable "azure_worker_nodes" { + type = object({ + count = string + control_plane = bool + instance_type = string + disk_size_gb = string + azs = list(string) + is_system_node_pool = bool + }) + default = { + count = "1" + control_plane = false + instance_type = "Standard_A8_v2" + disk_size_gb = "60" + azs = ["1"] + is_system_node_pool = false } + description = "Azure worker nodes configuration." +} + +####### +# GCP +####### +variable "gcp-cloud-account-name" { + type = string + description = "The name of your GCP account as assigned in Palette." + default = "" +} + +variable "gcp_project_name" { + type = string + description = "The name of your GCP project." + default = "" +} + +variable "deploy-gcp" { + type = bool + description = "A flag for enabling a deployment on GCP." +} + +variable "deploy-gcp-new" { + type = bool + description = "A flag for enabling a deployment on GCP with Kubecost." +} + +variable "gcp-region" { + type = string + description = "GCP region" + default = "us-central1" +} + +variable "gcp_control_plane_nodes" { + type = object({ + count = string + control_plane = bool + instance_type = string + disk_size_gb = string + availability_zones = list(string) + }) + default = { + count = "1" + control_plane = true + instance_type = "n1-standard-4" + disk_size_gb = "60" + availability_zones = ["us-central1-a"] } + description = "GCP control plane nodes configuration." +} + +variable "gcp_worker_nodes" { + type = object({ + count = string + control_plane = bool + instance_type = string + disk_size_gb = string + availability_zones = list(string) + }) + default = { + count = "1" + control_plane = false + instance_type = "n1-standard-4" + disk_size_gb = "60" + availability_zones = ["us-central1-a"] } + description = "GCP worker nodes configuration." +} + +variable "tags" { + type = list(string) + description = "The default tags to apply to Palette resources." + default = [ + "spectro-cloud-education", + "app:hello-universe", + "repository:spectrocloud:tutorials", + "terraform_managed:true", + "tutorial:getting-started-terraform" + ] +} + + +######## +# VMware +######## + +variable "deploy-vmware" { + type = bool + description = "A flag for enabling a deployment on VMware." +} + +variable "deploy-vmware-new" { + type = bool + description = "A flag for enabling a deployment on VMware with Kubecost." +} + +variable "metallb_ip" { + type = string + description = "The IP address range for your MetalLB load balancer." +} + +variable "ssh_key" { + type = string + description = "The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated." + + validation { + condition = var.ssh_key == "" ? true : fileexists(var.ssh_key) + error_message = "The provided SSH key file does not exist. Please, provide a valid path." + } +} + +variable "ssh_key_private" { + type = string + description = "The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated." + + validation { + condition = var.ssh_key_private == "" ? true : fileexists(var.ssh_key_private) + error_message = "The provided SSH key file does not exist. Please, provide a valid path." + } +} + +variable "datacenter_name" { + type = string + description = "The name of the datacenter in vSphere.." +} + +variable "folder_name" { + type = string + description = "The name of the folder in vSphere." +} + +variable "search_domain" { + type = string + description = "The name of network search domain." +} + +# Input resources for the cluster - Placement +variable "vsphere_cluster" { + type = string + description = "The name of your vSphere cluster." +} + +variable "datastore_name" { + type = string + description = "The name of the vSphere datastore." +} + +variable "network_name" { + type = string + description = "The name of the vSphere network." +} + +variable "resource_pool_name" { + type = string + description = "The name of the vSphere resource pool." +} + +variable "pcg_name" { + type = string + description = "The name of the PCG that will be used to deploy the cluster." +} + +# Input resources for the Static IP Pool (required for static IP placement) +# variable "network_gateway" { +# type = string +# description = "The IP address of the vSphere network gateway." +# } + +# variable "network_prefix" { +# type = number +# description = "The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18." +# } + +# variable "ip_range_start" { +# type = string +# description = "The first IP address of your PCG IP pool range." +# } + +# variable "ip_range_end" { +# type = string +# description = "The last IP address of your PCG IP pool range." +# } + +# variable "nameserver_addr" { +# type = set(string) +# description = "A comma-separated list of DNS nameserver IP addresses of your network." +# } + + +############################## +# Hello Universe App Variables +############################## +variable "app_namespace" { + type = string + description = "The namespace in which the application will be deployed." +} + +variable "app_port" { + type = number + description = "The cluster port number on which the service will listen for incoming traffic." +} + +variable "replicas_number" { + type = number + description = "The number of pods to be created." +} + +variable "db_password" { + type = string + description = "The base64 encoded database password to connect to the API database." +} + +variable "auth_token" { + type = string + description = "The base64 encoded auth token for the API connection." +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/ippool.tf b/terraform/getting-started-deployment-tf/ippool.tf new file mode 100644 index 0000000..042ef14 --- /dev/null +++ b/terraform/getting-started-deployment-tf/ippool.tf @@ -0,0 +1,14 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +# Required for static IP placement. +# resource "spectrocloud_privatecloudgateway_ippool" "ippool" { +# gateway = var.network_gateway +# name = "${var.cluster_name}-ippool" +# network_type = "range" +# prefix = var.network_prefix +# private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id +# ip_start_range = var.ip_range_start +# ip_end_range = var.ip_range_end +# nameserver_addresses = var.nameserver_addr +# } \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml b/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml new file mode 100644 index 0000000..eddbb4a --- /dev/null +++ b/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml @@ -0,0 +1,20 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +pack: + content: + images: + - image: ghcr.io/spectrocloud/hello-universe:1.1.2 + +manifests: + hello-universe: + images: + hellouniverse: ghcr.io/spectrocloud/hello-universe:1.1.2-proxy + hellouniverseapi: ghcr.io/spectrocloud/hello-universe-api:1.0.12 + hellouniversedb: ghcr.io/spectrocloud/hello-universe-db:1.0.2 + apiEnabled: true + namespace: ${namespace} + port: ${port} + replicas: ${replicas} + dbPassword: ${db_password} # Add base64 encoded password + authToken: ${auth_token} # Add base64 encoded token diff --git a/terraform/getting-started-deployment-tf/outputs.tf b/terraform/getting-started-deployment-tf/outputs.tf new file mode 100644 index 0000000..48b2286 --- /dev/null +++ b/terraform/getting-started-deployment-tf/outputs.tf @@ -0,0 +1,35 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +output "Advisory" { + value = <<-EOT + +It takes between one to three minutes for DNS to properly resolve the public load balancer URL. +We recommend waiting a few minutes before clicking on the service URL to prevent the browser from caching an unresolved DNS request. + +EOT +} + +####################### +# VMware SSH Key Output +####################### + +output "ssh_key_location" { + description = "Location of the generated private SSH key file." + value = length(tls_private_key.tutorial_ssh_key) > 0 && var.deploy-vmware == true ? "This is the location of the generated private SSH key file: ${local_sensitive_file.private_key_file[0].filename}." : null +} + +output "ssh_public_key_location" { + description = "Location of the generated public SSH key file." + value = length(tls_private_key.tutorial_ssh_key) > 0 && var.deploy-vmware == true ? "This is the location of the generated public SSH key file: ${local_file.public_key_file[0].filename}." : null +} + +output "ssh_connection_command" { + description = "Command to use the generated private SSH key to access the nodes." + value = length(tls_private_key.tutorial_ssh_key) > 0 && var.deploy-vmware == true ? "To access your nodes, use the following command, replacing with the username and with the IP address of your node: ssh -i ${local_sensitive_file.private_key_file[0].filename} @" : null +} + +output "ssh_connection_command_user" { + description = "Command to use the user's private SSH key to access the nodes." + value = var.ssh_key != "" && var.deploy-vmware == true ? "To access your nodes, use the following command, replacing with the username and with the IP address of your node: ssh -i ${var.ssh_key_private} @" : null +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/provider.tf b/terraform/getting-started-deployment-tf/provider.tf new file mode 100644 index 0000000..1d41efc --- /dev/null +++ b/terraform/getting-started-deployment-tf/provider.tf @@ -0,0 +1,34 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +terraform { + required_providers { + spectrocloud = { + version = ">= 0.19.0-pre" + source = "spectrocloud/spectrocloud" + } + + tls = { + source = "hashicorp/tls" + version = "4.0.4" + } + + vsphere = { + source = "hashicorp/vsphere" + version = ">= 2.6.1" + } + + local = { + source = "hashicorp/local" + version = "2.4.1" + } + } + + required_version = ">= 1.5" +} + + +provider "spectrocloud" { + # API key set through the environment variable SPECTROCLOUD_APIKEY + project_name = "Default" +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/ssh-key.tf b/terraform/getting-started-deployment-tf/ssh-key.tf new file mode 100644 index 0000000..ee42343 --- /dev/null +++ b/terraform/getting-started-deployment-tf/ssh-key.tf @@ -0,0 +1,39 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +############### +# Azure SSH Key +############### + +resource "tls_private_key" "tutorial_ssh_key_azure" { + count = var.deploy-azure ? 1 : 0 + algorithm = "RSA" + rsa_bits = "4096" +} + +################ +# VMware SSH Key +################ + +resource "tls_private_key" "tutorial_ssh_key" { + count = var.ssh_key == "" && var.ssh_key_private == "" && var.deploy-vmware == true ? 1 : 0 + algorithm = "RSA" + rsa_bits = "4096" +} + +locals { + ssh_public_key = var.ssh_key != "" ? var.ssh_key : length(tls_private_key.tutorial_ssh_key) > 0 ? tls_private_key.tutorial_ssh_key[0].public_key_openssh : null +} + +resource "local_sensitive_file" "private_key_file" { + count = length(tls_private_key.tutorial_ssh_key) > 0 ? 1 : 0 + content = tls_private_key.tutorial_ssh_key[0].private_key_openssh + filename = "${path.module}/tutorial_ssh_key" + file_permission = "0600" +} + +resource "local_file" "public_key_file" { + count = length(tls_private_key.tutorial_ssh_key) > 0 ? 1 : 0 + content = tls_private_key.tutorial_ssh_key[0].public_key_openssh + filename = "${path.module}/tutorial_ssh_key.pub" +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/terraform.tfvars b/terraform/getting-started-deployment-tf/terraform.tfvars new file mode 100644 index 0000000..85d4f1a --- /dev/null +++ b/terraform/getting-started-deployment-tf/terraform.tfvars @@ -0,0 +1,122 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 + +############################## +# Hello Universe Configuration +############################## + +app_namespace = "hello-universe" # The namespace in which the application will be deployed. +app_port = 8080 # The cluster port number on which the service will listen for incoming traffic. +replicas_number = 1 # The number of pods to be created. +db_password = "REPLACE ME" # The base64 encoded database password to connect to the API database. +auth_token = "REPLACE ME" # The base64 encoded auth token for the API connection. + + +########################### +# AWS Deployment Settings +############################ +deploy-aws = false # Set to true to deploy to AWS. +deploy-aws-new = false # Set to true to deploy to AWS and include Kubecost to your cluster profile. + +aws-cloud-account-name = "REPLACE ME" +aws-region = "REPLACE ME" +aws-key-pair-name = "REPLACE ME" + +aws_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.xlarge" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] # If you want to deploy to multiple AZs, add them here. Example: ["us-east-1a", "us-east-1b"]. +} + +aws_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.xlarge" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] # If you want to deploy to multiple AZs, add them here. Example: ["us-east-1a", "us-east-1b"]. +} + +########################### +# Azure Deployment Settings +############################ +deploy-azure = false # Set to true to deploy to Azure. +deploy-azure-new = false # Set to true to deploy to Azure and include Kubecost to your cluster profile. +azure-use-azs = true # Set to false when you deploy to a region without AZs. + +azure-cloud-account-name = "REPLACE ME" +azure-region = "REPLACE ME" +azure_subscription_id = "REPLACE ME" +azure_resource_group = "REPLACE ME" + + +azure_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "Standard_A8_v2" + disk_size_gb = "60" + azs = ["1"] # If you want to deploy to multiple AZs, add them here. + is_system_node_pool = false +} + +azure_worker_nodes = { + count = "1" + control_plane = false + instance_type = "Standard_A8_v2" + disk_size_gb = "60" + azs = ["1"] # If you want to deploy to multiple AZs, add them here. + is_system_node_pool = false +} + +########################### +# GCP Deployment Settings +############################ +deploy-gcp = false # Set to true to deploy to GCP. +deploy-gcp-new = false # Set to true to deploy to GCP and include Kubecost to your cluster profile. + +gcp-cloud-account-name = "REPLACE ME" +gcp-region = "REPLACE ME" +gcp_project_name = "REPLACE ME" + +gcp_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "n1-standard-4" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] # If you want to deploy to multiple AZs, add them here. Example: ["us-central1-a", "us-central1-b"]. +} + +gcp_worker_nodes = { + count = "1" + control_plane = false + instance_type = "n1-standard-4" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] # If you want to deploy to multiple AZs, add them here. Example: ["us-central1-a", "us-central1-b"]. +} + +############################ +# VMware Deployment Settings +############################ +deploy-vmware = false # Set to true to deploy to VMware. +deploy-vmware-new = false # Set to true to deploy to VMware and include Kubecost to your cluster profile. + +metallb_ip = "REPLACE ME" # Provide a range of IP addresses for your Metallb load balancer. This range must be included in the PCG's static IP pool range if using static IP placement. +pcg_name = "REPLACE ME" # Provide the name of the PCG that will be used to deploy the Palette cluster. +datacenter_name = "REPLACE ME" # Provide the name of the datacenter in vSphere. +folder_name = "REPLACE ME" # Provide the name of the folder in vSphere. +search_domain = "REPLACE ME" # Provide the name of the network search domain. +vsphere_cluster = "REPLACE ME" # Provide the cluster name for the machine pool as it appears in vSphere. +datastore_name = "REPLACE ME" # Provide the datastore name for the machine pool as it appears in vSphere. +network_name = "REPLACE ME" # Provide the network name for the machine pool as it appears in vSphere. +resource_pool_name = "REPLACE ME" # Provide the resource pool name for the machine pool as it appears in vSphere. +ssh_key = "" # Provide the path to your public SSH key. If not provided, a new key pair will be created. +ssh_key_private = "" # Provide the path to your private SSH key. If not provided, a new key pair will be created. + +# Static IP Pool Variables +# Required for static IP placement only. +# network_gateway = "REPLACE ME" # Provide the IP address of the vSphere network gateway. +# network_prefix = "REPLACE ME" # Provide the prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. +# ip_range_start = "REPLACE ME" # Provide the first IP address of your PCG IP pool range. +# ip_range_end = "REPLACE ME" # Provide the second IP address of your PCG IP pool range. +# nameserver_addr = ["REPLACE ME"] # Provide a comma-separated list of DNS name server IP addresses. \ No newline at end of file From e32acb7c5a836c53f1d6ab7ba1ad3f0eb48c0a35 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Fri, 14 Jun 2024 17:07:34 -0400 Subject: [PATCH 02/12] fix: address review suggestions --- .../getting-started-deployment-tf/README.md | 107 ++++++++++-------- .../cluster_profiles.tf | 48 ++++---- .../getting-started-deployment-tf/clusters.tf | 18 ++- .../getting-started-deployment-tf/data.tf | 7 +- .../getting-started-deployment-tf/inputs.tf | 67 +++++++---- .../getting-started-deployment-tf/ippool.tf | 21 ++-- .../getting-started-deployment-tf/provider.tf | 2 +- .../terraform.tfvars | 43 +++---- 8 files changed, 172 insertions(+), 141 deletions(-) diff --git a/terraform/getting-started-deployment-tf/README.md b/terraform/getting-started-deployment-tf/README.md index 9714489..92f36d5 100644 --- a/terraform/getting-started-deployment-tf/README.md +++ b/terraform/getting-started-deployment-tf/README.md @@ -14,6 +14,8 @@ This Terraform code has three main toggle variables that you can use to deploy t To get started, open up the file **terraform.tfvars**. Toggle the provider variable mentioned in the table and start providing values for the respective cloud provider. Make sure you specify a value to your cloud provider variables and replace all values containing the string `REPLACE ME`. + + ## Requirements | Name | Version | @@ -29,7 +31,7 @@ To get started, open up the file **terraform.tfvars**. Toggle the provider varia | Name | Version | | --------------------------------------------------------------------------- | ------- | | [local](#provider_local) | 2.4.1 | -| [spectrocloud](#provider_spectrocloud) | 0.19.2 | +| [spectrocloud](#provider_spectrocloud) | 0.19.3 | | [tls](#provider_tls) | 4.0.4 | ## Modules @@ -38,49 +40,51 @@ No modules. ## Resources -| Name | Type | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | -| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | -| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | -| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | -| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | -| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | -| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.aws-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile-new](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | -| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | -| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | -| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | -| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | -| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | -| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| Name | Type | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | +| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | +| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | +| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | +| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | +| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.aws-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | +| [spectrocloud_privatecloudgateway_ippool.ippool](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/privatecloudgateway_ippool) | resource | +| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | +| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | +| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | +| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | +| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_private_cloud_gateway.pcg](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/private_cloud_gateway) | data source | +| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | ## Inputs @@ -105,21 +109,28 @@ No modules. | [datastore_name](#input_datastore_name) | The name of the vSphere datastore. | `string` | n/a | yes | | [db_password](#input_db_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | | [deploy-aws](#input_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | -| [deploy-aws-new](#input_deploy-aws-new) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | +| [deploy-aws-kubecost](#input_deploy-aws-kubecost) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | | [deploy-azure](#input_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | -| [deploy-azure-new](#input_deploy-azure-new) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | +| [deploy-azure-kubecost](#input_deploy-azure-kubecost) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | | [deploy-gcp](#input_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | -| [deploy-gcp-new](#input_deploy-gcp-new) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | +| [deploy-gcp-kubecost](#input_deploy-gcp-kubecost) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | | [deploy-vmware](#input_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | -| [deploy-vmware-new](#input_deploy-vmware-new) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware-kubecost](#input_deploy-vmware-kubecost) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware-static](#input_deploy-vmware-static) | A flag for enabling a deployment on VMware using static IP placement. | `bool` | n/a | yes | | [folder_name](#input_folder_name) | The name of the folder in vSphere. | `string` | n/a | yes | | [gcp-cloud-account-name](#input_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | | [gcp-region](#input_gcp-region) | GCP region | `string` | `"us-central1"` | no | | [gcp_control_plane_nodes](#input_gcp_control_plane_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | | [gcp_project_name](#input_gcp_project_name) | The name of your GCP project. | `string` | `""` | no | | [gcp_worker_nodes](#input_gcp_worker_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [ip_range_end](#input_ip_range_end) | The last IP address of your PCG IP pool range. | `string` | n/a | yes | +| [ip_range_start](#input_ip_range_start) | The first IP address of your PCG IP pool range. | `string` | n/a | yes | | [metallb_ip](#input_metallb_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | +| [nameserver_addr](#input_nameserver_addr) | A comma-separated list of DNS nameserver IP addresses of your network. | `set(string)` | n/a | yes | +| [network_gateway](#input_network_gateway) | The IP address of the vSphere network gateway. | `string` | n/a | yes | | [network_name](#input_network_name) | The name of the vSphere network. | `string` | n/a | yes | +| [network_prefix](#input_network_prefix) | The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. | `number` | n/a | yes | +| [palette-project](#input_palette-project) | The name of your project in Palette. | `string` | `""` | no | | [pcg_name](#input_pcg_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | | [replicas_number](#input_replicas_number) | The number of pods to be created. | `number` | n/a | yes | | [resource_pool_name](#input_resource_pool_name) | The name of the vSphere resource pool. | `string` | n/a | yes | diff --git a/terraform/getting-started-deployment-tf/cluster_profiles.tf b/terraform/getting-started-deployment-tf/cluster_profiles.tf index 5fa635c..2a21bf7 100644 --- a/terraform/getting-started-deployment-tf/cluster_profiles.tf +++ b/terraform/getting-started-deployment-tf/cluster_profiles.tf @@ -50,8 +50,8 @@ resource "spectrocloud_cluster_profile" "aws-profile" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } } @@ -59,8 +59,8 @@ resource "spectrocloud_cluster_profile" "aws-profile" { ############################ # AWS Cluster Profile v1.1.0 ############################ -resource "spectrocloud_cluster_profile" "aws-profile-new" { - count = var.deploy-aws-new ? 1 : 0 +resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { + count = var.deploy-aws-kubecost ? 1 : 0 name = "tf-aws-profile" description = "A basic cluster profile for AWS with Kubecost" @@ -105,8 +105,8 @@ resource "spectrocloud_cluster_profile" "aws-profile-new" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } @@ -167,8 +167,8 @@ resource "spectrocloud_cluster_profile" "azure-profile" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } } @@ -176,8 +176,8 @@ resource "spectrocloud_cluster_profile" "azure-profile" { ############################## # Azure Cluster Profile v1.1.0 ############################## -resource "spectrocloud_cluster_profile" "azure-profile-new" { - count = var.deploy-azure-new ? 1 : 0 +resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { + count = var.deploy-azure-kubecost ? 1 : 0 name = "tf-azure-profile" description = "A basic cluster profile for Azure with Kubecost" @@ -222,8 +222,8 @@ resource "spectrocloud_cluster_profile" "azure-profile-new" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } @@ -285,8 +285,8 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } } @@ -294,8 +294,8 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { ############################ # GCP Cluster Profile v1.1.0 ############################ -resource "spectrocloud_cluster_profile" "gcp-profile-new" { - count = var.deploy-gcp-new ? 1 : 0 +resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { + count = var.deploy-gcp-kubecost ? 1 : 0 name = "tf-gcp-profile" description = "A basic cluster profile for GCP with Kubecost" @@ -340,8 +340,8 @@ resource "spectrocloud_cluster_profile" "gcp-profile-new" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number, - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } @@ -409,8 +409,8 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number, - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } } @@ -418,8 +418,8 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { ############################### # VMware Cluster Profile v1.1.0 ############################### -resource "spectrocloud_cluster_profile" "vmware-profile-new" { - count = var.deploy-vmware-new ? 1 : 0 +resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { + count = var.deploy-vmware-kubecost ? 1 : 0 name = "tf-vmware-profile" description = "A basic cluster profile for VMware with Kubecost" @@ -471,8 +471,8 @@ resource "spectrocloud_cluster_profile" "vmware-profile-new" { namespace = var.app_namespace, port = var.app_port, replicas = var.replicas_number, - db_password = var.db_password, - auth_token = var.auth_token + db_password = base64encode(var.db_password), + auth_token = base64encode(var.auth_token) }) } diff --git a/terraform/getting-started-deployment-tf/clusters.tf b/terraform/getting-started-deployment-tf/clusters.tf index 972c855..c55e5b9 100644 --- a/terraform/getting-started-deployment-tf/clusters.tf +++ b/terraform/getting-started-deployment-tf/clusters.tf @@ -17,8 +17,7 @@ resource "spectrocloud_cluster_aws" "aws-cluster" { } cluster_profile { - id = spectrocloud_cluster_profile.aws-profile[0].id - #id = spectrocloud_cluster_profile.aws-profile-new[0].id + id = var.deploy-aws && var.deploy-aws-kubecost ? spectrocloud_cluster_profile.aws-profile-kubecost[0].id : spectrocloud_cluster_profile.aws-profile[0].id } machine_pool { @@ -62,8 +61,7 @@ resource "spectrocloud_cluster_azure" "azure-cluster" { } cluster_profile { - #id = spectrocloud_cluster_profile.azure-profile[0].id - id = spectrocloud_cluster_profile.azure-profile-new[0].id + id = var.deploy-azure && var.deploy-azure-kubecost ? spectrocloud_cluster_profile.azure-profile-kubecost[0].id : spectrocloud_cluster_profile.azure-profile[0].id } machine_pool { @@ -110,8 +108,7 @@ resource "spectrocloud_cluster_gcp" "gcp-cluster" { } cluster_profile { - id = spectrocloud_cluster_profile.gcp-profile[0].id - #id = spectrocloud_cluster_profile.gcp-profile-new[0].id + id = var.deploy-gcp && var.deploy-gcp-kubecost ? spectrocloud_cluster_profile.gcp-profile-kubecost[0].id : spectrocloud_cluster_profile.gcp-profile[0].id } machine_pool { @@ -153,13 +150,12 @@ resource "spectrocloud_cluster_vsphere" "vmware-cluster" { ssh_key = local.ssh_public_key datacenter = var.datacenter_name folder = var.folder_name - static_ip = false # If true, the cluster will use static IP placement. If false, the cluster will use DDNS. + static_ip = var.deploy-vmware-static # If true, the cluster will use static IP placement. If false, the cluster will use DDNS. network_search_domain = var.search_domain } cluster_profile { - id = spectrocloud_cluster_profile.vmware-profile[0].id - #id = spectrocloud_cluster_profile.vmware-profile-new[0].id + id = var.deploy-vmware && var.deploy-vmware-kubecost ? spectrocloud_cluster_profile.vmware-profile-kubecost[0].id : spectrocloud_cluster_profile.vmware-profile[0].id } scan_policy { @@ -186,7 +182,7 @@ resource "spectrocloud_cluster_vsphere" "vmware-cluster" { network = var.network_name resource_pool = var.resource_pool_name # Required for static IP placement. - #static_ip_pool_id = resource.spectrocloud_privatecloudgateway_ippool.ippool.id + static_ip_pool_id = var.deploy-vmware-static ? resource.spectrocloud_privatecloudgateway_ippool.ippool[0].id : null } } @@ -208,7 +204,7 @@ resource "spectrocloud_cluster_vsphere" "vmware-cluster" { network = var.network_name resource_pool = var.resource_pool_name # Required for static IP placement. - #static_ip_pool_id = resource.spectrocloud_privatecloudgateway_ippool.ippool.id + static_ip_pool_id = var.deploy-vmware-static ? resource.spectrocloud_privatecloudgateway_ippool.ippool[0].id : null } } diff --git a/terraform/getting-started-deployment-tf/data.tf b/terraform/getting-started-deployment-tf/data.tf index 8a1e2ce..d36f996 100644 --- a/terraform/getting-started-deployment-tf/data.tf +++ b/terraform/getting-started-deployment-tf/data.tf @@ -148,9 +148,10 @@ data "spectrocloud_pack" "vmware_metallb" { } # Required for static IP placement -# data "spectrocloud_private_cloud_gateway" "pcg" { -# name = var.pcg_name -# } +data "spectrocloud_private_cloud_gateway" "pcg" { + count = var.deploy-vmware-static ? 1 : 0 + name = var.pcg_name +} ##################### # Hello Universe Pack diff --git a/terraform/getting-started-deployment-tf/inputs.tf b/terraform/getting-started-deployment-tf/inputs.tf index ac570ad..abb8a8b 100644 --- a/terraform/getting-started-deployment-tf/inputs.tf +++ b/terraform/getting-started-deployment-tf/inputs.tf @@ -1,6 +1,16 @@ # Copyright (c) Spectro Cloud # SPDX-License-Identifier: Apache-2.0 +######### +# Palette +######### + +variable "palette-project" { + type = string + description = "The name of your project in Palette." + default = "" +} + ####### # AWS ####### @@ -15,7 +25,7 @@ variable "deploy-aws" { description = "A flag for enabling a deployment on AWS." } -variable "deploy-aws-new" { +variable "deploy-aws-kubecost" { type = bool description = "A flag for enabling a deployment on AWS with Kubecost." } @@ -81,7 +91,7 @@ variable "deploy-azure" { description = "A flag for enabling a deployment on Azure." } -variable "deploy-azure-new" { +variable "deploy-azure-kubecost" { type = bool description = "A flag for enabling a deployment on Azure with Kubecost." } @@ -167,7 +177,7 @@ variable "deploy-gcp" { description = "A flag for enabling a deployment on GCP." } -variable "deploy-gcp-new" { +variable "deploy-gcp-kubecost" { type = bool description = "A flag for enabling a deployment on GCP with Kubecost." } @@ -234,7 +244,7 @@ variable "deploy-vmware" { description = "A flag for enabling a deployment on VMware." } -variable "deploy-vmware-new" { +variable "deploy-vmware-kubecost" { type = bool description = "A flag for enabling a deployment on VMware with Kubecost." } @@ -305,31 +315,36 @@ variable "pcg_name" { description = "The name of the PCG that will be used to deploy the cluster." } -# Input resources for the Static IP Pool (required for static IP placement) -# variable "network_gateway" { -# type = string -# description = "The IP address of the vSphere network gateway." -# } +# Input resources for the Static IP Pool (required for static IP placement only) +variable "deploy-vmware-static" { + type = bool + description = "A flag for enabling a deployment on VMware using static IP placement." +} -# variable "network_prefix" { -# type = number -# description = "The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18." -# } +variable "network_gateway" { + type = string + description = "The IP address of the vSphere network gateway." +} -# variable "ip_range_start" { -# type = string -# description = "The first IP address of your PCG IP pool range." -# } +variable "network_prefix" { + type = number + description = "The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18." +} + +variable "ip_range_start" { + type = string + description = "The first IP address of your PCG IP pool range." +} -# variable "ip_range_end" { -# type = string -# description = "The last IP address of your PCG IP pool range." -# } +variable "ip_range_end" { + type = string + description = "The last IP address of your PCG IP pool range." +} -# variable "nameserver_addr" { -# type = set(string) -# description = "A comma-separated list of DNS nameserver IP addresses of your network." -# } +variable "nameserver_addr" { + type = set(string) + description = "A comma-separated list of DNS nameserver IP addresses of your network." +} ############################## @@ -353,9 +368,11 @@ variable "replicas_number" { variable "db_password" { type = string description = "The base64 encoded database password to connect to the API database." + sensitive = true } variable "auth_token" { type = string description = "The base64 encoded auth token for the API connection." + sensitive = true } \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/ippool.tf b/terraform/getting-started-deployment-tf/ippool.tf index 042ef14..373cfb5 100644 --- a/terraform/getting-started-deployment-tf/ippool.tf +++ b/terraform/getting-started-deployment-tf/ippool.tf @@ -2,13 +2,14 @@ # SPDX-License-Identifier: Apache-2.0 # Required for static IP placement. -# resource "spectrocloud_privatecloudgateway_ippool" "ippool" { -# gateway = var.network_gateway -# name = "${var.cluster_name}-ippool" -# network_type = "range" -# prefix = var.network_prefix -# private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg.id -# ip_start_range = var.ip_range_start -# ip_end_range = var.ip_range_end -# nameserver_addresses = var.nameserver_addr -# } \ No newline at end of file +resource "spectrocloud_privatecloudgateway_ippool" "ippool" { + count = var.deploy-vmware-static ? 1 : 0 + gateway = var.network_gateway + name = "vsphere-vmware-ippool" + network_type = "range" + prefix = var.network_prefix + private_cloud_gateway_id = data.spectrocloud_private_cloud_gateway.pcg[0].id + ip_start_range = var.ip_range_start + ip_end_range = var.ip_range_end + nameserver_addresses = var.nameserver_addr +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/provider.tf b/terraform/getting-started-deployment-tf/provider.tf index 1d41efc..89bc813 100644 --- a/terraform/getting-started-deployment-tf/provider.tf +++ b/terraform/getting-started-deployment-tf/provider.tf @@ -30,5 +30,5 @@ terraform { provider "spectrocloud" { # API key set through the environment variable SPECTROCLOUD_APIKEY - project_name = "Default" + project_name = var.palette-project } \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/terraform.tfvars b/terraform/getting-started-deployment-tf/terraform.tfvars index 85d4f1a..83da6bd 100644 --- a/terraform/getting-started-deployment-tf/terraform.tfvars +++ b/terraform/getting-started-deployment-tf/terraform.tfvars @@ -1,22 +1,27 @@ # Copyright (c) Spectro Cloud # SPDX-License-Identifier: Apache-2.0 +##################### +# Palette Settings +##################### +palette-project = "Default" # The name of your project in Palette. + + ############################## # Hello Universe Configuration ############################## - app_namespace = "hello-universe" # The namespace in which the application will be deployed. app_port = 8080 # The cluster port number on which the service will listen for incoming traffic. replicas_number = 1 # The number of pods to be created. -db_password = "REPLACE ME" # The base64 encoded database password to connect to the API database. -auth_token = "REPLACE ME" # The base64 encoded auth token for the API connection. +db_password = "REPLACE ME" # The database password to connect to the API database. +auth_token = "REPLACE ME" # The auth token for the API connection. ########################### # AWS Deployment Settings ############################ -deploy-aws = false # Set to true to deploy to AWS. -deploy-aws-new = false # Set to true to deploy to AWS and include Kubecost to your cluster profile. +deploy-aws = false # Set to true to deploy to AWS. +deploy-aws-kubecost = false # Set to true to deploy to AWS and include Kubecost to your cluster profile. aws-cloud-account-name = "REPLACE ME" aws-region = "REPLACE ME" @@ -41,9 +46,9 @@ aws_worker_nodes = { ########################### # Azure Deployment Settings ############################ -deploy-azure = false # Set to true to deploy to Azure. -deploy-azure-new = false # Set to true to deploy to Azure and include Kubecost to your cluster profile. -azure-use-azs = true # Set to false when you deploy to a region without AZs. +deploy-azure = false # Set to true to deploy to Azure. +deploy-azure-kubecost = false # Set to true to deploy to Azure and include Kubecost to your cluster profile. +azure-use-azs = true # Set to false when you deploy to a region without AZs. azure-cloud-account-name = "REPLACE ME" azure-region = "REPLACE ME" @@ -72,8 +77,8 @@ azure_worker_nodes = { ########################### # GCP Deployment Settings ############################ -deploy-gcp = false # Set to true to deploy to GCP. -deploy-gcp-new = false # Set to true to deploy to GCP and include Kubecost to your cluster profile. +deploy-gcp = false # Set to true to deploy to GCP. +deploy-gcp-kubecost = false # Set to true to deploy to GCP and include Kubecost to your cluster profile. gcp-cloud-account-name = "REPLACE ME" gcp-region = "REPLACE ME" @@ -98,8 +103,8 @@ gcp_worker_nodes = { ############################ # VMware Deployment Settings ############################ -deploy-vmware = false # Set to true to deploy to VMware. -deploy-vmware-new = false # Set to true to deploy to VMware and include Kubecost to your cluster profile. +deploy-vmware = false # Set to true to deploy to VMware. +deploy-vmware-kubecost = false # Set to true to deploy to VMware and include Kubecost to your cluster profile. metallb_ip = "REPLACE ME" # Provide a range of IP addresses for your Metallb load balancer. This range must be included in the PCG's static IP pool range if using static IP placement. pcg_name = "REPLACE ME" # Provide the name of the PCG that will be used to deploy the Palette cluster. @@ -113,10 +118,10 @@ resource_pool_name = "REPLACE ME" # Provide the resource pool name for the machi ssh_key = "" # Provide the path to your public SSH key. If not provided, a new key pair will be created. ssh_key_private = "" # Provide the path to your private SSH key. If not provided, a new key pair will be created. -# Static IP Pool Variables -# Required for static IP placement only. -# network_gateway = "REPLACE ME" # Provide the IP address of the vSphere network gateway. -# network_prefix = "REPLACE ME" # Provide the prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. -# ip_range_start = "REPLACE ME" # Provide the first IP address of your PCG IP pool range. -# ip_range_end = "REPLACE ME" # Provide the second IP address of your PCG IP pool range. -# nameserver_addr = ["REPLACE ME"] # Provide a comma-separated list of DNS name server IP addresses. \ No newline at end of file +# Static IP Pool Variables - Required for static IP placement only. +deploy-vmware-static = false # Set to true to deploy to VMware using static IP placement. +network_gateway = "REPLACE ME" # Provide the IP address of the vSphere network gateway. +network_prefix = 0 # Provide the prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. +ip_range_start = "REPLACE ME" # Provide the first IP address of your PCG IP pool range. +ip_range_end = "REPLACE ME" # Provide the second IP address of your PCG IP pool range. +nameserver_addr = ["REPLACE ME"] # Provide a comma-separated list of DNS name server IP addresses. \ No newline at end of file From 4541271a8ad7c4b95d4571dd8ec43a7b1fc052d7 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Tue, 18 Jun 2024 14:55:01 -0400 Subject: [PATCH 03/12] docs: fix azure azs issue --- terraform/getting-started-deployment-tf/clusters.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/getting-started-deployment-tf/clusters.tf b/terraform/getting-started-deployment-tf/clusters.tf index c55e5b9..ed2f8e8 100644 --- a/terraform/getting-started-deployment-tf/clusters.tf +++ b/terraform/getting-started-deployment-tf/clusters.tf @@ -70,7 +70,7 @@ resource "spectrocloud_cluster_azure" "azure-cluster" { name = "control-plane-pool" count = var.azure_control_plane_nodes.count instance_type = var.azure_control_plane_nodes.instance_type - azs = var.azure_control_plane_nodes.azs + azs = var.azure-use-azs ? var.azure_control_plane_nodes.azs : [""] is_system_node_pool = var.azure_control_plane_nodes.is_system_node_pool disk { size_gb = var.azure_control_plane_nodes.disk_size_gb @@ -82,7 +82,7 @@ resource "spectrocloud_cluster_azure" "azure-cluster" { name = "worker-basic" count = var.azure_worker_nodes.count instance_type = var.azure_worker_nodes.instance_type - azs = var.azure_worker_nodes.azs + azs = var.azure-use-azs ? var.azure_worker_nodes.azs : [""] is_system_node_pool = var.azure_worker_nodes.is_system_node_pool } From 684e049a837e4d80d4aa2503321a542796a898d4 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Thu, 20 Jun 2024 11:41:33 -0400 Subject: [PATCH 04/12] fix: add k9s to the container image, review grammar of docker.md --- Dockerfile | 4 +++- docs/docker.md | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9268ff..682ca54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -65,7 +65,9 @@ RUN wget https://spectro-cli.s3.amazonaws.com/v$PALETTE_REGISTRY_CLI_VERSION/li rm -rf /var/cache/apk/* && \ wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \ unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin && \ - rm -rf terraform_${TERRAFORM_VERSION}_linux_amd64.zip + rm -rf terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \ + wget https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_Linux_amd64.tar.gz -O - | tar -xz -C /usr/local/bin && \ + rm -rf k9s_Linux_amd64.tar ADD https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip /usr/local/sbin/ RUN unzip /usr/local/sbin/packer_${PACKER_VERSION}_linux_amd64.zip -d /usr/local/sbin && \ diff --git a/docs/docker.md b/docs/docker.md index e48e5b3..d2d88f8 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,6 +1,6 @@ ## Docker -To download the image issue the following commnad. Change the version tag as needed. +To download the image, issue the following command. Change the version tag as needed. ```shell docker pull ghcr.io/spectrocloud/tutorials:1.0.12 @@ -12,7 +12,7 @@ You can start the container using the following command. docker run -p 5000:5000 --rm -it ghcr.io/spectrocloud/tutorials:1.0.12 bash ``` -> The Docker file is build for a Linux environment. You can use this on a Mac and Windows. Windows users will require the usage of WSL2. +> The Docker file builds a Linux environment. You can use this image on a Mac and Windows. Windows users will require the usage of [WSL2](https://learn.microsoft.com/en-us/windows/wsl/about). The Docker image includes the following tools. @@ -41,6 +41,7 @@ The Docker image includes the following tools. | `aws-cli` | AWS command-line interface | | `oras` | Tool for pushing and pulling OCI artifacts to and from OCI registries | | `podman` | Tool for building and deploying OCI images | +| `k9s` | Tool that provides a terminal UI to interact with your Kubernetes clusters | ### Spectro Cloud Pack Registry Server @@ -50,7 +51,7 @@ The Spectro Cloud registry server has the following credentials: - `password`: `admin` -You can start the registry server by issuing the following command. +You can start the registry server by issuing the command below. Keep in mind that the registry server is started in HTTP mode. For additional guidance, review the [Registry Server documentation](https://docs.spectrocloud.com/registries-and-packs/adding-a-custom-registry). ```shell @@ -59,7 +60,7 @@ registry serve /etc/spectro/config.yml > /var/log/registry.log 2>&1 & # Local Builds -If you are wanting to build the docker image locally you must provide the the build arguments for `PALETTE_VERSION`, `PALETTE_CLI_VERSION`, `PALETTE_EDGE_VERSION`, `PACKER_VERSION`, `ORAS_VERSION` and `TERRAFORM_VERSION`. Use the following command to build a local image. Replace the versions as needed. +If you want to build the docker image locally, you must provide the build arguments for `PALETTE_VERSION`, `PALETTE_CLI_VERSION`, `PALETTE_EDGE_VERSION`, `PACKER_VERSION`, `ORAS_VERSION`, and `TERRAFORM_VERSION`. Use the following command to build a local image and replace the versions as needed. ```shell docker build --build-arg PALETTE_VERSION=4.0.2 --build-arg PALETTE_CLI_VERSION=4.2.2 --build-arg PALETTE_EDGE_VERSION=4.2.3 --build-arg PACKER_VERSION=1.9.4 --build-arg ORAS_VERSION=1.0.0 --build-arg PALETTE_REGISTRY_CLI_VERSION=4.2.0 --build-arg TERRAFORM_VERSION=1.7.0 -t tutorials . From 624bb5f911480ee418fec8deaa33dd6d549354d9 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Tue, 2 Jul 2024 10:45:45 -0400 Subject: [PATCH 05/12] fix: add terraform tests --- .../getting-started-deployment-tf/README.md | 258 +++++++++--------- .../getting-started-deployment-tf/clusters.tf | 10 +- .../getting-started-deployment-tf/inputs.tf | 136 ++++++++- .../getting-started-deployment-tf/provider.tf | 2 +- .../tests/aws-kubecost.tftest.hcl | 50 ++++ .../tests/aws-replace.tftest.hcl | 42 +++ .../tests/aws.tftest.hcl | 45 +++ .../tests/azure-kubecost.tftest.hcl | 37 +++ .../tests/azure-replace.tftest.hcl | 28 ++ .../tests/azure.tftest.hcl | 37 +++ .../tests/gcp-kubecost.tftest.hcl | 50 ++++ .../tests/gcp-replace.tftest.hcl | 42 +++ .../tests/gcp.tftest.hcl | 45 +++ .../tests/pack-hello-uni.tftest.hcl | 39 +++ .../tests/project-palette.tftest.hcl | 18 ++ .../tests/vmware-ip-pool.tftest.hcl | 31 +++ .../tests/vmware-kubecost.tftest.hcl | 42 +++ .../tests/vmware-replace.tftest.hcl | 38 +++ .../tests/vmware-ssh.tftest.hcl | 44 +++ .../tests/vmware.tftest.hcl | 37 +++ 20 files changed, 894 insertions(+), 137 deletions(-) create mode 100644 terraform/getting-started-deployment-tf/tests/aws-kubecost.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/aws-replace.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/aws.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/azure-kubecost.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/azure-replace.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/azure.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/gcp-kubecost.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/gcp-replace.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/gcp.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/pack-hello-uni.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/project-palette.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/vmware-ip-pool.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/vmware-kubecost.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/vmware-replace.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/vmware-ssh.tftest.hcl create mode 100644 terraform/getting-started-deployment-tf/tests/vmware.tftest.hcl diff --git a/terraform/getting-started-deployment-tf/README.md b/terraform/getting-started-deployment-tf/README.md index 92f36d5..26b4ca4 100644 --- a/terraform/getting-started-deployment-tf/README.md +++ b/terraform/getting-started-deployment-tf/README.md @@ -1,38 +1,43 @@ -# IaaS Cluster Deployment +# Getting Started Cluster Deployment -This Terraform code is explained in the [Deploy a Cluster](https://docs.spectrocloud.com/clusters/public-cloud/deploy-k8s-cluster) tutorial. +This folder contains the demo code for the **Getting Started Cluster Management with Terraform** tutorials. -This Terraform code has three main toggle variables that you can use to deploy to one of the following cloud providers. +- [Cluster Management with Terraform - AWS](https://docs.spectrocloud.com/getting-started/aws/manage-cluster-tf) +- [Cluster Management with Terraform - Azure](https://docs.spectrocloud.com/getting-started/azure/manage-cluster-tf) +- [Cluster Management with Terraform - GCP](https://docs.spectrocloud.com/getting-started/gcp/manage-cluster-tf) +- [Cluster Management with Terraform - VMware](https://docs.spectrocloud.com/getting-started/vmware/manage-cluster-tf) -| Variable | Provider | Description | Default | -| -------------- | -------- | ------------------------------------ | ------- | -| `deploy-aws` | AWS | Enable to deploy a cluster to AWS. | `false` | -| `deploy-azure` | GCP | Enable to deploy a cluster to Azure. | `false` | -| `deploy-gcp` | Azure | Enable to deploy a cluster to GCP. | `false` | +The Terraform code has four main toggle variables that you can use to deploy to one of the following cloud providers. -> You can enable as many of the providers as you want. You just need to ensure all provider's required values are specified. +| Variable | Provider | Description | Default | +| --------------- | -------------- | --------------------------------------------- | ------- | +| `deploy-aws` | AWS | Enable to deploy a cluster to AWS. | `false` | +| `deploy-azure` | GCP | Enable to deploy a cluster to Azure. | `false` | +| `deploy-gcp` | Azure | Enable to deploy a cluster to GCP. | `false` | +| `deploy-vmware` | VMware vSphere | Enable to deploy a cluster to VMware vSphere. | `false` | -To get started, open up the file **terraform.tfvars**. Toggle the provider variable mentioned in the table and start providing values for the respective cloud provider. Make sure you specify a value to your cloud provider variables and replace all values containing the string `REPLACE ME`. +> You can enable as many providers as you want, just make sure to specify all required values for each provider. - +To get started, open the **terraform.tfvars** file. Toggle the provider variable as specified in the table and provide values to your cloud provider variables, replacing all instances of the string `REPLACE ME`. + ## Requirements -| Name | Version | -| --------------------------------------------------------------------------------- | ------------- | -| [terraform](#requirement_terraform) | >= 1.5 | -| [local](#requirement_local) | 2.4.1 | -| [spectrocloud](#requirement_spectrocloud) | >= 0.19.0-pre | -| [tls](#requirement_tls) | 4.0.4 | -| [vsphere](#requirement_vsphere) | >= 2.6.1 | +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.9 | +| [local](#requirement\_local) | 2.4.1 | +| [spectrocloud](#requirement\_spectrocloud) | >= 0.19.0-pre | +| [tls](#requirement\_tls) | 4.0.4 | +| [vsphere](#requirement\_vsphere) | >= 2.6.1 | ## Providers -| Name | Version | -| --------------------------------------------------------------------------- | ------- | -| [local](#provider_local) | 2.4.1 | -| [spectrocloud](#provider_spectrocloud) | 0.19.3 | -| [tls](#provider_tls) | 4.0.4 | +| Name | Version | +|------|---------| +| [local](#provider\_local) | 2.4.1 | +| [spectrocloud](#provider\_spectrocloud) | 0.20.6 | +| [tls](#provider\_tls) | 4.0.4 | ## Modules @@ -40,114 +45,113 @@ No modules. ## Resources -| Name | Type | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | -| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | -| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | -| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | -| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | -| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.aws-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | -| [spectrocloud_privatecloudgateway_ippool.ippool](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/privatecloudgateway_ippool) | resource | -| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | -| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | -| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | -| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | -| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_private_cloud_gateway.pcg](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/private_cloud_gateway) | data source | -| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | -| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| Name | Type | +|------|------| +| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | +| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | +| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | +| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | +| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | +| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.aws-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | +| [spectrocloud_privatecloudgateway_ippool.ippool](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/privatecloudgateway_ippool) | resource | +| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | +| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | +| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | +| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | +| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_private_cloud_gateway.pcg](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/private_cloud_gateway) | data source | +| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | ## Inputs -| Name | Description | Type | Default | Required | -| ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | -| [app_namespace](#input_app_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes | -| [app_port](#input_app_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes | -| [auth_token](#input_auth_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes | -| [aws-cloud-account-name](#input_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | `""` | no | -| [aws-key-pair-name](#input_aws-key-pair-name) | The name of the AWS key pair to use for SSH access to the cluster. | `string` | `""` | no | -| [aws-region](#input_aws-region) | AWS region | `string` | `"us-east-1"` | no | -| [aws_control_plane_nodes](#input_aws_control_plane_nodes) | AWS control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | -| [aws_worker_nodes](#input_aws_worker_nodes) | AWS worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | -| [azure-cloud-account-name](#input_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no | -| [azure-region](#input_azure-region) | Azure region. | `string` | `"eastus"` | no | -| [azure-use-azs](#input_azure-use-azs) | A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource. | `bool` | n/a | yes | -| [azure_control_plane_nodes](#input_azure_control_plane_nodes) | Azure control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | -| [azure_resource_group](#input_azure_resource_group) | Azure resource group. | `string` | `""` | no | -| [azure_subscription_id](#input_azure_subscription_id) | Azure subscription ID. | `string` | `""` | no | -| [azure_worker_nodes](#input_azure_worker_nodes) | Azure worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | -| [datacenter_name](#input_datacenter_name) | The name of the datacenter in vSphere.. | `string` | n/a | yes | -| [datastore_name](#input_datastore_name) | The name of the vSphere datastore. | `string` | n/a | yes | -| [db_password](#input_db_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | -| [deploy-aws](#input_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | -| [deploy-aws-kubecost](#input_deploy-aws-kubecost) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | -| [deploy-azure](#input_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | -| [deploy-azure-kubecost](#input_deploy-azure-kubecost) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | -| [deploy-gcp](#input_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | -| [deploy-gcp-kubecost](#input_deploy-gcp-kubecost) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | -| [deploy-vmware](#input_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | -| [deploy-vmware-kubecost](#input_deploy-vmware-kubecost) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | -| [deploy-vmware-static](#input_deploy-vmware-static) | A flag for enabling a deployment on VMware using static IP placement. | `bool` | n/a | yes | -| [folder_name](#input_folder_name) | The name of the folder in vSphere. | `string` | n/a | yes | -| [gcp-cloud-account-name](#input_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | -| [gcp-region](#input_gcp-region) | GCP region | `string` | `"us-central1"` | no | -| [gcp_control_plane_nodes](#input_gcp_control_plane_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | -| [gcp_project_name](#input_gcp_project_name) | The name of your GCP project. | `string` | `""` | no | -| [gcp_worker_nodes](#input_gcp_worker_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | -| [ip_range_end](#input_ip_range_end) | The last IP address of your PCG IP pool range. | `string` | n/a | yes | -| [ip_range_start](#input_ip_range_start) | The first IP address of your PCG IP pool range. | `string` | n/a | yes | -| [metallb_ip](#input_metallb_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | -| [nameserver_addr](#input_nameserver_addr) | A comma-separated list of DNS nameserver IP addresses of your network. | `set(string)` | n/a | yes | -| [network_gateway](#input_network_gateway) | The IP address of the vSphere network gateway. | `string` | n/a | yes | -| [network_name](#input_network_name) | The name of the vSphere network. | `string` | n/a | yes | -| [network_prefix](#input_network_prefix) | The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. | `number` | n/a | yes | -| [palette-project](#input_palette-project) | The name of your project in Palette. | `string` | `""` | no | -| [pcg_name](#input_pcg_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | -| [replicas_number](#input_replicas_number) | The number of pods to be created. | `number` | n/a | yes | -| [resource_pool_name](#input_resource_pool_name) | The name of the vSphere resource pool. | `string` | n/a | yes | -| [search_domain](#input_search_domain) | The name of network search domain. | `string` | n/a | yes | -| [ssh_key](#input_ssh_key) | The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | -| [ssh_key_private](#input_ssh_key_private) | The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | -| [tags](#input_tags) | The default tags to apply to Palette resources. | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"repository:spectrocloud:tutorials",
"terraform_managed:true",
"tutorial:getting-started-terraform"
]
| no | -| [vsphere_cluster](#input_vsphere_cluster) | The name of your vSphere cluster. | `string` | n/a | yes | +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [app\_namespace](#input\_app\_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes | +| [app\_port](#input\_app\_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes | +| [auth\_token](#input\_auth\_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes | +| [aws-cloud-account-name](#input\_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | n/a | yes | +| [aws-key-pair-name](#input\_aws-key-pair-name) | The name of the AWS key pair to use for SSH access to the cluster. | `string` | n/a | yes | +| [aws-region](#input\_aws-region) | AWS region | `string` | `"us-east-1"` | no | +| [aws\_control\_plane\_nodes](#input\_aws\_control\_plane\_nodes) | AWS control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [aws\_worker\_nodes](#input\_aws\_worker\_nodes) | AWS worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [azure-cloud-account-name](#input\_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no | +| [azure-region](#input\_azure-region) | Azure region. | `string` | `"eastus"` | no | +| [azure-use-azs](#input\_azure-use-azs) | A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource. | `bool` | n/a | yes | +| [azure\_control\_plane\_nodes](#input\_azure\_control\_plane\_nodes) | Azure control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [azure\_resource\_group](#input\_azure\_resource\_group) | Azure resource group. | `string` | `""` | no | +| [azure\_subscription\_id](#input\_azure\_subscription\_id) | Azure subscription ID. | `string` | `""` | no | +| [azure\_worker\_nodes](#input\_azure\_worker\_nodes) | Azure worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [datacenter\_name](#input\_datacenter\_name) | The name of the datacenter in vSphere. | `string` | n/a | yes | +| [datastore\_name](#input\_datastore\_name) | The name of the vSphere datastore. | `string` | n/a | yes | +| [db\_password](#input\_db\_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | +| [deploy-aws](#input\_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | +| [deploy-aws-kubecost](#input\_deploy-aws-kubecost) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | +| [deploy-azure](#input\_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | +| [deploy-azure-kubecost](#input\_deploy-azure-kubecost) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | +| [deploy-gcp](#input\_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | +| [deploy-gcp-kubecost](#input\_deploy-gcp-kubecost) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware](#input\_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | +| [deploy-vmware-kubecost](#input\_deploy-vmware-kubecost) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware-static](#input\_deploy-vmware-static) | A flag for enabling a deployment on VMware using static IP placement. | `bool` | n/a | yes | +| [folder\_name](#input\_folder\_name) | The name of the folder in vSphere. | `string` | n/a | yes | +| [gcp-cloud-account-name](#input\_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | +| [gcp-region](#input\_gcp-region) | GCP region | `string` | `"us-central1"` | no | +| [gcp\_control\_plane\_nodes](#input\_gcp\_control\_plane\_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [gcp\_project\_name](#input\_gcp\_project\_name) | The name of your GCP project. | `string` | `""` | no | +| [gcp\_worker\_nodes](#input\_gcp\_worker\_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [ip\_range\_end](#input\_ip\_range\_end) | The last IP address of your PCG IP pool range. | `string` | n/a | yes | +| [ip\_range\_start](#input\_ip\_range\_start) | The first IP address of your PCG IP pool range. | `string` | n/a | yes | +| [metallb\_ip](#input\_metallb\_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | +| [nameserver\_addr](#input\_nameserver\_addr) | A comma-separated list of DNS nameserver IP addresses of your network. | `set(string)` | n/a | yes | +| [network\_gateway](#input\_network\_gateway) | The IP address of the vSphere network gateway. | `string` | n/a | yes | +| [network\_name](#input\_network\_name) | The name of the vSphere network. | `string` | n/a | yes | +| [network\_prefix](#input\_network\_prefix) | The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. | `number` | n/a | yes | +| [palette-project](#input\_palette-project) | The name of your project in Palette. | `string` | n/a | yes | +| [pcg\_name](#input\_pcg\_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | +| [replicas\_number](#input\_replicas\_number) | The number of pods to be created. | `number` | n/a | yes | +| [resource\_pool\_name](#input\_resource\_pool\_name) | The name of the vSphere resource pool. | `string` | n/a | yes | +| [search\_domain](#input\_search\_domain) | The name of network search domain. | `string` | n/a | yes | +| [ssh\_key](#input\_ssh\_key) | The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [ssh\_key\_private](#input\_ssh\_key\_private) | The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [tags](#input\_tags) | The default tags to apply to Palette resources. | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"repository:spectrocloud:tutorials",
"terraform_managed:true",
"tutorial:getting-started-terraform"
]
| no | +| [vsphere\_cluster](#input\_vsphere\_cluster) | The name of your vSphere cluster. | `string` | n/a | yes | ## Outputs -| Name | Description | -| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -| [Advisory](#output_Advisory) | n/a | -| [ssh_connection_command](#output_ssh_connection_command) | Command to use the generated private SSH key to access the nodes. | -| [ssh_connection_command_user](#output_ssh_connection_command_user) | Command to use the user's private SSH key to access the nodes. | -| [ssh_key_location](#output_ssh_key_location) | Location of the generated private SSH key file. | -| [ssh_public_key_location](#output_ssh_public_key_location) | Location of the generated public SSH key file. | - +| Name | Description | +|------|-------------| +| [Advisory](#output\_Advisory) | n/a | +| [ssh\_connection\_command](#output\_ssh\_connection\_command) | Command to use the generated private SSH key to access the nodes. | +| [ssh\_connection\_command\_user](#output\_ssh\_connection\_command\_user) | Command to use the user's private SSH key to access the nodes. | +| [ssh\_key\_location](#output\_ssh\_key\_location) | Location of the generated private SSH key file. | +| [ssh\_public\_key\_location](#output\_ssh\_public\_key\_location) | Location of the generated public SSH key file. | diff --git a/terraform/getting-started-deployment-tf/clusters.tf b/terraform/getting-started-deployment-tf/clusters.tf index ed2f8e8..5e172dc 100644 --- a/terraform/getting-started-deployment-tf/clusters.tf +++ b/terraform/getting-started-deployment-tf/clusters.tf @@ -17,7 +17,7 @@ resource "spectrocloud_cluster_aws" "aws-cluster" { } cluster_profile { - id = var.deploy-aws && var.deploy-aws-kubecost ? spectrocloud_cluster_profile.aws-profile-kubecost[0].id : spectrocloud_cluster_profile.aws-profile[0].id + id = var.deploy-aws && var.deploy-aws-kubecost ? resource.spectrocloud_cluster_profile.aws-profile-kubecost[0].id : resource.spectrocloud_cluster_profile.aws-profile[0].id } machine_pool { @@ -61,7 +61,7 @@ resource "spectrocloud_cluster_azure" "azure-cluster" { } cluster_profile { - id = var.deploy-azure && var.deploy-azure-kubecost ? spectrocloud_cluster_profile.azure-profile-kubecost[0].id : spectrocloud_cluster_profile.azure-profile[0].id + id = var.deploy-azure && var.deploy-azure-kubecost ? resource.spectrocloud_cluster_profile.azure-profile-kubecost[0].id : resource.spectrocloud_cluster_profile.azure-profile[0].id } machine_pool { @@ -108,7 +108,7 @@ resource "spectrocloud_cluster_gcp" "gcp-cluster" { } cluster_profile { - id = var.deploy-gcp && var.deploy-gcp-kubecost ? spectrocloud_cluster_profile.gcp-profile-kubecost[0].id : spectrocloud_cluster_profile.gcp-profile[0].id + id = var.deploy-gcp && var.deploy-gcp-kubecost ? resource.spectrocloud_cluster_profile.gcp-profile-kubecost[0].id : resource.spectrocloud_cluster_profile.gcp-profile[0].id } machine_pool { @@ -147,7 +147,7 @@ resource "spectrocloud_cluster_vsphere" "vmware-cluster" { cloud_account_id = data.spectrocloud_cloudaccount_vsphere.account[0].id cloud_config { - ssh_key = local.ssh_public_key + ssh_keys = [local.ssh_public_key] datacenter = var.datacenter_name folder = var.folder_name static_ip = var.deploy-vmware-static # If true, the cluster will use static IP placement. If false, the cluster will use DDNS. @@ -155,7 +155,7 @@ resource "spectrocloud_cluster_vsphere" "vmware-cluster" { } cluster_profile { - id = var.deploy-vmware && var.deploy-vmware-kubecost ? spectrocloud_cluster_profile.vmware-profile-kubecost[0].id : spectrocloud_cluster_profile.vmware-profile[0].id + id = var.deploy-vmware && var.deploy-vmware-kubecost ? resource.spectrocloud_cluster_profile.vmware-profile-kubecost[0].id : resource.spectrocloud_cluster_profile.vmware-profile[0].id } scan_policy { diff --git a/terraform/getting-started-deployment-tf/inputs.tf b/terraform/getting-started-deployment-tf/inputs.tf index abb8a8b..5ba2532 100644 --- a/terraform/getting-started-deployment-tf/inputs.tf +++ b/terraform/getting-started-deployment-tf/inputs.tf @@ -8,7 +8,12 @@ variable "palette-project" { type = string description = "The name of your project in Palette." - default = "" + + validation { + condition = var.palette-project != "" + error_message = "Provide the correct Palette project." + } + } ####### @@ -17,7 +22,11 @@ variable "palette-project" { variable "aws-cloud-account-name" { type = string description = "The name of your AWS account as assigned in Palette." - default = "" + + validation { + condition = var.deploy-aws ? var.aws-cloud-account-name != "REPLACE ME" && var.aws-cloud-account-name != "" : true + error_message = "Provide the correct AWS cloud account name." + } } variable "deploy-aws" { @@ -34,12 +43,21 @@ variable "aws-region" { type = string description = "AWS region" default = "us-east-1" + + validation { + condition = var.deploy-aws ? var.aws-region != "REPLACE ME" && var.aws-region != "" : true + error_message = "Provide the correct AWS region." + } } variable "aws-key-pair-name" { type = string description = "The name of the AWS key pair to use for SSH access to the cluster." - default = "" + + validation { + condition = var.deploy-aws ? var.aws-key-pair-name != "REPLACE ME" && var.aws-key-pair-name != "" : true + error_message = "Provide the correct AWS SSH key pair name." + } } variable "aws_control_plane_nodes" { @@ -58,6 +76,11 @@ variable "aws_control_plane_nodes" { availability_zones = ["us-east-1a"] } description = "AWS control plane nodes configuration." + + validation { + condition = var.deploy-aws ? length(var.aws_control_plane_nodes.availability_zones) > 0 && !contains(var.aws_control_plane_nodes.availability_zones, "REPLACE ME") : true + error_message = "The availability_zones parameter must be set correctly" + } } variable "aws_worker_nodes" { type = object({ @@ -75,6 +98,11 @@ variable "aws_worker_nodes" { availability_zones = ["us-east-1a"] } description = "AWS worker nodes configuration." + + validation { + condition = var.deploy-aws ? length(var.aws_worker_nodes.availability_zones) > 0 && !contains(var.aws_worker_nodes.availability_zones, "REPLACE ME") : true + error_message = "The availability_zones parameter must be set correctly" + } } ####### @@ -84,6 +112,11 @@ variable "azure-cloud-account-name" { type = string description = "The name of your Azure account as assigned in Palette." default = "" + + validation { + condition = var.deploy-azure ? var.azure-cloud-account-name != "REPLACE ME" && var.azure-cloud-account-name != "" : true + error_message = "Provide the correct Azure cloud account name." + } } variable "deploy-azure" { @@ -100,12 +133,22 @@ variable "azure_subscription_id" { type = string description = "Azure subscription ID." default = "" + + validation { + condition = var.deploy-azure ? var.azure_subscription_id != "REPLACE ME" && var.azure_subscription_id != "" : true + error_message = "Provide the correct Azure subscription ID." + } } variable "azure_resource_group" { type = string description = "Azure resource group." default = "" + + validation { + condition = var.deploy-azure ? var.azure_resource_group != "REPLACE ME" && var.azure_resource_group != "" : true + error_message = "Provide the correct Azure resource group name." + } } variable "azure-use-azs" { @@ -117,6 +160,11 @@ variable "azure-region" { type = string description = "Azure region." default = "eastus" + + validation { + condition = var.deploy-azure ? var.azure-region != "REPLACE ME" && var.azure-region != "" : true + error_message = "Provide the correct Azure region name." + } } variable "azure_control_plane_nodes" { @@ -164,12 +212,22 @@ variable "gcp-cloud-account-name" { type = string description = "The name of your GCP account as assigned in Palette." default = "" + + validation { + condition = var.deploy-gcp ? var.gcp-cloud-account-name != "REPLACE ME" && var.gcp-cloud-account-name != "" : true + error_message = "Provide the correct GCP cloud account name." + } } variable "gcp_project_name" { type = string description = "The name of your GCP project." default = "" + + validation { + condition = var.deploy-gcp ? var.gcp_project_name != "REPLACE ME" && var.gcp_project_name != "" : true + error_message = "Provide the correct GCP project name." + } } variable "deploy-gcp" { @@ -186,6 +244,11 @@ variable "gcp-region" { type = string description = "GCP region" default = "us-central1" + + validation { + condition = var.deploy-gcp ? var.gcp-region != "REPLACE ME" && var.gcp-region != "" : true + error_message = "Provide the correct GCP region." + } } variable "gcp_control_plane_nodes" { @@ -203,6 +266,11 @@ variable "gcp_control_plane_nodes" { disk_size_gb = "60" availability_zones = ["us-central1-a"] } description = "GCP control plane nodes configuration." + + validation { + condition = var.deploy-gcp ? length(var.gcp_control_plane_nodes.availability_zones) > 0 && !contains(var.gcp_control_plane_nodes.availability_zones, "REPLACE ME") : true + error_message = "The availability_zones parameter must be set correctly" + } } variable "gcp_worker_nodes" { @@ -220,6 +288,11 @@ variable "gcp_worker_nodes" { disk_size_gb = "60" availability_zones = ["us-central1-a"] } description = "GCP worker nodes configuration." + + validation { + condition = var.deploy-gcp ? length(var.gcp_worker_nodes.availability_zones) > 0 && !contains(var.gcp_worker_nodes.availability_zones, "REPLACE ME") : true + error_message = "The availability_zones parameter must be set correctly" + } } variable "tags" { @@ -252,6 +325,11 @@ variable "deploy-vmware-kubecost" { variable "metallb_ip" { type = string description = "The IP address range for your MetalLB load balancer." + + validation { + condition = var.deploy-vmware ? var.metallb_ip != "REPLACE ME" && var.metallb_ip != "" : true + error_message = "Provide the correct MetalLB IP." + } } variable "ssh_key" { @@ -276,43 +354,83 @@ variable "ssh_key_private" { variable "datacenter_name" { type = string - description = "The name of the datacenter in vSphere.." + description = "The name of the datacenter in vSphere." + + validation { + condition = var.deploy-vmware ? var.datacenter_name != "REPLACE ME" && var.datacenter_name != "" : true + error_message = "Provide the correct VMware vSphere datacenter name." + } } variable "folder_name" { type = string description = "The name of the folder in vSphere." + + validation { + condition = var.deploy-vmware ? var.folder_name != "REPLACE ME" && var.folder_name != "" : true + error_message = "Provide the correct VMware vSphere folder name." + } } variable "search_domain" { type = string description = "The name of network search domain." + + validation { + condition = var.deploy-vmware ? var.search_domain != "REPLACE ME" && var.search_domain != "" : true + error_message = "Provide the correct VMware vSphere search domain." + } } # Input resources for the cluster - Placement variable "vsphere_cluster" { type = string description = "The name of your vSphere cluster." + + validation { + condition = var.deploy-vmware ? var.vsphere_cluster != "REPLACE ME" && var.vsphere_cluster != "" : true + error_message = "Provide the correct VMware vSphere cluster name." + } } variable "datastore_name" { type = string description = "The name of the vSphere datastore." + + validation { + condition = var.deploy-vmware ? var.datastore_name != "REPLACE ME" && var.datastore_name != "" : true + error_message = "Provide the correct VMware vSphere datastore name." + } } variable "network_name" { type = string description = "The name of the vSphere network." + + validation { + condition = var.deploy-vmware ? var.network_name != "REPLACE ME" && var.network_name != "" : true + error_message = "Provide the correct VMware vSphere network name." + } } variable "resource_pool_name" { type = string description = "The name of the vSphere resource pool." + + validation { + condition = var.deploy-vmware ? var.resource_pool_name != "REPLACE ME" && var.resource_pool_name != "" : true + error_message = "Provide the correct VMware vSphere resource pool name." + } } variable "pcg_name" { type = string description = "The name of the PCG that will be used to deploy the cluster." + + validation { + condition = var.deploy-vmware ? var.pcg_name != "REPLACE ME" && var.pcg_name != "" : true + error_message = "Provide the correct VMware vSphere PCG name." + } } # Input resources for the Static IP Pool (required for static IP placement only) @@ -369,10 +487,20 @@ variable "db_password" { type = string description = "The base64 encoded database password to connect to the API database." sensitive = true + + validation { + condition = var.deploy-aws || var.deploy-azure || var.deploy-gcp || var.deploy-vmware ? var.db_password != "REPLACE ME" && var.db_password != "" : true + error_message = "Provide the correct database password." + } } variable "auth_token" { type = string description = "The base64 encoded auth token for the API connection." sensitive = true + + validation { + condition = var.deploy-aws || var.deploy-azure || var.deploy-gcp || var.deploy-vmware ? var.auth_token != "REPLACE ME" && var.auth_token != "" : true + error_message = "Provide the correct authentication token." + } } \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/provider.tf b/terraform/getting-started-deployment-tf/provider.tf index 89bc813..6b3dda8 100644 --- a/terraform/getting-started-deployment-tf/provider.tf +++ b/terraform/getting-started-deployment-tf/provider.tf @@ -24,7 +24,7 @@ terraform { } } - required_version = ">= 1.5" + required_version = ">= 1.9" } diff --git a/terraform/getting-started-deployment-tf/tests/aws-kubecost.tftest.hcl b/terraform/getting-started-deployment-tf/tests/aws-kubecost.tftest.hcl new file mode 100644 index 0000000..347de6b --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/aws-kubecost.tftest.hcl @@ -0,0 +1,50 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 4 + +variables { + deploy-aws = true + deploy-aws-kubecost = true + db_password = "test_password" + auth_token = "test_token" + aws-cloud-account-name = "test-account" + aws-region = "test-region" + aws-key-pair-name = "test-aws-key-pair" + aws_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } + aws_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } +} + +mock_provider "spectrocloud" { +} + +run "verify_aws_kubecost" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.aws-profile) == 1 + error_message = "No AWS cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_profile.aws-profile-kubecost) == 1 + error_message = "No AWS cluster profile with Kubecost was created" + } + + assert { + condition = length(spectrocloud_cluster_aws.aws-cluster) == 1 + error_message = "No AWS cluster was created" + } +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/tests/aws-replace.tftest.hcl b/terraform/getting-started-deployment-tf/tests/aws-replace.tftest.hcl new file mode 100644 index 0000000..374b02c --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/aws-replace.tftest.hcl @@ -0,0 +1,42 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 5 + +variables { + deploy-aws = true + db_password = "test_password" + auth_token = "test_token" + aws-cloud-account-name = "REPLACE ME" + aws-region = "REPLACE ME" + aws-key-pair-name = "REPLACE ME" + aws_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] + } + aws_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] + } +} + +mock_provider "spectrocloud" {} + +run "verify_aws" { + + command = plan + + expect_failures = [ + var.aws-cloud-account-name, + var.aws-key-pair-name, + var.aws-region, + var.aws_control_plane_nodes.availability_zones, + var.aws_worker_nodes.availability_zones + ] + +} diff --git a/terraform/getting-started-deployment-tf/tests/aws.tftest.hcl b/terraform/getting-started-deployment-tf/tests/aws.tftest.hcl new file mode 100644 index 0000000..69f86cf --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/aws.tftest.hcl @@ -0,0 +1,45 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 3 + +variables { + deploy-aws = true + db_password = "test_password" + auth_token = "test_token" + aws-cloud-account-name = "test-account" + aws-region = "test-region" + aws-key-pair-name = "test-aws-key-pair" + aws_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } + aws_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } +} + +mock_provider "spectrocloud" { +} + +run "verify_aws" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.aws-profile) == 1 + error_message = "No AWS cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_aws.aws-cluster) == 1 + error_message = "No AWS cluster was created" + } + +} diff --git a/terraform/getting-started-deployment-tf/tests/azure-kubecost.tftest.hcl b/terraform/getting-started-deployment-tf/tests/azure-kubecost.tftest.hcl new file mode 100644 index 0000000..b00825a --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/azure-kubecost.tftest.hcl @@ -0,0 +1,37 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 7 + +variables { + deploy-azure = true + deploy-azure-kubecost = true + db_password = "test_password" + auth_token = "test_token" + azure-cloud-account-name = "test-account" + azure-region = "test-region" + azure_subscription_id = "test-azure-subscription-id" + azure_resource_group = "test-azure-resource-group" +} + +mock_provider "spectrocloud" { +} + +run "verify_azure_kubecost" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.azure-profile) == 1 + error_message = "No Azure cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_profile.azure-profile-kubecost) == 1 + error_message = "No Azure cluster profile with Kubecost was created" + } + + assert { + condition = length(spectrocloud_cluster_azure.azure-cluster) == 1 + error_message = "No Azure cluster was created" + } +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/tests/azure-replace.tftest.hcl b/terraform/getting-started-deployment-tf/tests/azure-replace.tftest.hcl new file mode 100644 index 0000000..66fe232 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/azure-replace.tftest.hcl @@ -0,0 +1,28 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 8 + +variables { + deploy-azure = true + db_password = "test_password" + auth_token = "test_token" + azure-cloud-account-name = "REPLACE ME" + azure-region = "REPLACE ME" + azure_subscription_id = "REPLACE ME" + azure_resource_group = "REPLACE ME" +} + +mock_provider "spectrocloud" {} + +run "verify_azure_replace" { + + command = plan + + expect_failures = [ + var.azure-cloud-account-name, + var.azure-region, + var.azure_subscription_id, + var.azure_resource_group + ] + +} diff --git a/terraform/getting-started-deployment-tf/tests/azure.tftest.hcl b/terraform/getting-started-deployment-tf/tests/azure.tftest.hcl new file mode 100644 index 0000000..f84c3c9 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/azure.tftest.hcl @@ -0,0 +1,37 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 6 + +variables { + deploy-azure = true + db_password = "test_password" + auth_token = "test_token" + azure-cloud-account-name = "test-account" + azure-region = "test-region" + azure_subscription_id = "test-azure-subscription-id" + azure_resource_group = "test-azure-resource-group" +} + +mock_provider "spectrocloud" { +} + +run "verify_azure" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.azure-profile) == 1 + error_message = "No Azure cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_azure.azure-cluster) == 1 + error_message = "No Azure cluster was created" + } + + assert { + condition = length(tls_private_key.tutorial_ssh_key_azure) == 1 + error_message = "No Azure SSH key was created" + } + +} diff --git a/terraform/getting-started-deployment-tf/tests/gcp-kubecost.tftest.hcl b/terraform/getting-started-deployment-tf/tests/gcp-kubecost.tftest.hcl new file mode 100644 index 0000000..f046a88 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/gcp-kubecost.tftest.hcl @@ -0,0 +1,50 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 11 + +variables { + deploy-gcp = true + deploy-gcp-kubecost = true + db_password = "test_password" + auth_token = "test_token" + gcp-cloud-account-name = "test-account" + gcp-region = "test-region" + gcp_project_name = "test-aws-key-pair" + gcp_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } + gcp_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } +} + +mock_provider "spectrocloud" { +} + +run "verify_gcp_kubecost" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.gcp-profile) == 1 + error_message = "No GCP cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_profile.gcp-profile-kubecost) == 1 + error_message = "No GCP cluster profile with Kubecost was created" + } + + assert { + condition = length(spectrocloud_cluster_gcp.gcp-cluster) == 1 + error_message = "No GCP cluster was created" + } +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/tests/gcp-replace.tftest.hcl b/terraform/getting-started-deployment-tf/tests/gcp-replace.tftest.hcl new file mode 100644 index 0000000..d6a7721 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/gcp-replace.tftest.hcl @@ -0,0 +1,42 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 12 + +variables { + deploy-gcp = true + db_password = "test_password" + auth_token = "test_token" + gcp-cloud-account-name = "REPLACE ME" + gcp-region = "REPLACE ME" + gcp_project_name = "REPLACE ME" + gcp_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] + } + gcp_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["REPLACE ME"] + } +} + +mock_provider "spectrocloud" {} + +run "verify_gcp" { + + command = plan + + expect_failures = [ + var.gcp-cloud-account-name, + var.gcp_project_name, + var.gcp-region, + var.gcp_control_plane_nodes.availability_zones, + var.gcp_worker_nodes.availability_zones + ] + +} diff --git a/terraform/getting-started-deployment-tf/tests/gcp.tftest.hcl b/terraform/getting-started-deployment-tf/tests/gcp.tftest.hcl new file mode 100644 index 0000000..660b80a --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/gcp.tftest.hcl @@ -0,0 +1,45 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 10 + +variables { + deploy-gcp = true + db_password = "test_password" + auth_token = "test_token" + gcp-cloud-account-name = "test-account" + gcp-region = "test-region" + gcp_project_name = "test-aws-key-pair" + gcp_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } + gcp_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } +} + +mock_provider "spectrocloud" { +} + +run "verify_gcp" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.gcp-profile) == 1 + error_message = "No GCP cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_gcp.gcp-cluster) == 1 + error_message = "No GCP cluster was created" + } + +} diff --git a/terraform/getting-started-deployment-tf/tests/pack-hello-uni.tftest.hcl b/terraform/getting-started-deployment-tf/tests/pack-hello-uni.tftest.hcl new file mode 100644 index 0000000..7197a36 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/pack-hello-uni.tftest.hcl @@ -0,0 +1,39 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 2 + +variables { + deploy-aws = true + db_password = "REPLACE ME" + auth_token = "REPLACE ME" + aws-cloud-account-name = "test-account" + aws-region = "test-region" + aws-key-pair-name = "test-aws-key-pair" + aws_control_plane_nodes = { + count = "1" + control_plane = true + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } + aws_worker_nodes = { + count = "1" + control_plane = false + instance_type = "m4.2xlarge" + disk_size_gb = "60" + availability_zones = ["us-east-1"] + } +} + +mock_provider "spectrocloud" {} + +run "wrong_variables" { + + command = plan + + expect_failures = [ + var.auth_token, + var.db_password + ] + +} diff --git a/terraform/getting-started-deployment-tf/tests/project-palette.tftest.hcl b/terraform/getting-started-deployment-tf/tests/project-palette.tftest.hcl new file mode 100644 index 0000000..c8e0f96 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/project-palette.tftest.hcl @@ -0,0 +1,18 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 1 + +variables { + palette-project = "" +} + +run "project_variable" { + + command = plan + + expect_failures = [ + var.palette-project + ] + + +} diff --git a/terraform/getting-started-deployment-tf/tests/vmware-ip-pool.tftest.hcl b/terraform/getting-started-deployment-tf/tests/vmware-ip-pool.tftest.hcl new file mode 100644 index 0000000..0bbbaf2 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/vmware-ip-pool.tftest.hcl @@ -0,0 +1,31 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 17 + +variables { + deploy-vmware = true + deploy-vmware-static = true + db_password = "test_password" + auth_token = "test_token" + metallb_ip = "test_ip" + pcg_name = "test_pcg" + datacenter_name = "test_datacenter" + folder_name = "test_folder" + search_domain = "test_search_domain" + vsphere_cluster = "test_cluster" + datastore_name = "test_datastore" + network_name = "test_network" + resource_pool_name = "test_resource_pool" +} + +mock_provider "spectrocloud" {} + +run "verify_vmware" { + + command = plan + + assert { + condition = length(spectrocloud_privatecloudgateway_ippool.ippool) == 1 + error_message = "No VMware IP pool was created" + } +} diff --git a/terraform/getting-started-deployment-tf/tests/vmware-kubecost.tftest.hcl b/terraform/getting-started-deployment-tf/tests/vmware-kubecost.tftest.hcl new file mode 100644 index 0000000..635f8ef --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/vmware-kubecost.tftest.hcl @@ -0,0 +1,42 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 14 + +variables { + deploy-vmware = true + deploy-vmware-kubecost = true + db_password = "test_password" + auth_token = "test_token" + metallb_ip = "test_ip" + pcg_name = "test_pcg" + datacenter_name = "test_datacenter" + folder_name = "test_folder" + search_domain = "test_search_domain" + vsphere_cluster = "test_cluster" + datastore_name = "test_datastore" + network_name = "test_network" + resource_pool_name = "test_resource_pool" +} + +mock_provider "spectrocloud" { +} + +run "verify_vmware_kubecost" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.vmware-profile) == 1 + error_message = "No VMware cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_profile.vmware-profile-kubecost) == 1 + error_message = "No VMware cluster profile with Kubecost was created" + } + + assert { + condition = length(spectrocloud_cluster_vsphere.vmware-cluster) == 1 + error_message = "No VMware cluster was created" + } +} \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/tests/vmware-replace.tftest.hcl b/terraform/getting-started-deployment-tf/tests/vmware-replace.tftest.hcl new file mode 100644 index 0000000..a115c5e --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/vmware-replace.tftest.hcl @@ -0,0 +1,38 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 15 + +variables { + deploy-vmware = true + db_password = "test_password" + auth_token = "test_token" + metallb_ip = "REPLACE ME" + pcg_name = "REPLACE ME" + datacenter_name = "REPLACE ME" + folder_name = "REPLACE ME" + search_domain = "REPLACE ME" + vsphere_cluster = "REPLACE ME" + datastore_name = "REPLACE ME" + network_name = "REPLACE ME" + resource_pool_name = "REPLACE ME" +} + +mock_provider "spectrocloud" {} + +run "verify_vmware" { + + command = plan + + expect_failures = [ + var.metallb_ip, + var.pcg_name, + var.datacenter_name, + var.folder_name, + var.search_domain, + var.vsphere_cluster, + var.datastore_name, + var.network_name, + var.resource_pool_name + ] + +} diff --git a/terraform/getting-started-deployment-tf/tests/vmware-ssh.tftest.hcl b/terraform/getting-started-deployment-tf/tests/vmware-ssh.tftest.hcl new file mode 100644 index 0000000..9d83ceb --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/vmware-ssh.tftest.hcl @@ -0,0 +1,44 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 16 + +variables { + deploy-vmware = true + db_password = "test_password" + auth_token = "test_token" + metallb_ip = "test_ip" + pcg_name = "test_pcg" + datacenter_name = "test_datacenter" + folder_name = "test_folder" + search_domain = "test_search_domain" + vsphere_cluster = "test_cluster" + datastore_name = "test_datastore" + network_name = "test_network" + resource_pool_name = "test_resource_pool" + ssh_key = "" + ssh_key_private = "" +} + +mock_provider "spectrocloud" { +} + +run "verify_vmware" { + + command = plan + + assert { + condition = length(tls_private_key.tutorial_ssh_key) == 1 + error_message = "No SSH key was created" + } + + assert { + condition = length(local_sensitive_file.private_key_file) == 1 + error_message = "The file to store the private key was not created" + } + + assert { + condition = length(local_file.public_key_file) == 1 + error_message = "The file to store the public key was not created" + } + +} diff --git a/terraform/getting-started-deployment-tf/tests/vmware.tftest.hcl b/terraform/getting-started-deployment-tf/tests/vmware.tftest.hcl new file mode 100644 index 0000000..06bbf20 --- /dev/null +++ b/terraform/getting-started-deployment-tf/tests/vmware.tftest.hcl @@ -0,0 +1,37 @@ +# Copyright (c) Spectro Cloud +# SPDX-License-Identifier: Apache-2.0 +# Test case 13 + +variables { + deploy-vmware = true + db_password = "test_password" + auth_token = "test_token" + metallb_ip = "test_ip" + pcg_name = "test_pcg" + datacenter_name = "test_datacenter" + folder_name = "test_folder" + search_domain = "test_search_domain" + vsphere_cluster = "test_cluster" + datastore_name = "test_datastore" + network_name = "test_network" + resource_pool_name = "test_resource_pool" +} + +mock_provider "spectrocloud" { +} + +run "verify_vmware" { + + command = plan + + assert { + condition = length(spectrocloud_cluster_profile.vmware-profile) == 1 + error_message = "No VMware cluster profile was created" + } + + assert { + condition = length(spectrocloud_cluster_vsphere.vmware-cluster) == 1 + error_message = "No VMware cluster was created" + } + +} From 5c397895fe4c0bee7a26c79cf1f640c67e127dae Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Tue, 2 Jul 2024 16:08:47 -0400 Subject: [PATCH 06/12] fix: addressed review suggestions --- .github/workflows/release.yaml | 2 + .github/workflows/test.yaml | 2 + Dockerfile | 3 +- Makefile | 3 +- docs/docker.md | 4 +- .../getting-started-deployment-tf/README.md | 236 +++++++++--------- 6 files changed, 129 insertions(+), 121 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7aa5496..4ed3866 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,6 +13,7 @@ env: ORAS_VERSION: 1.0.0 TERRAFORM_VERSION: 1.9.0 PALETTE_REGISTRY_CLI_VERSION: 4.3.0 + K9S_VERSION: 0.32.5 jobs: docker: @@ -68,6 +69,7 @@ jobs: ORAS_VERSION=${{env.ORAS_VERSION}} TERRAFORM_VERSION=${{env.TERRAFORM_VERSION}} PALETTE_REGISTRY_CLI_VERSION=${{env.PALETTE_REGISTRY_CLI_VERSION}} + K9S_VERSION=${{env.K9S_VERSION}} platforms: linux/amd64,linux/arm64 push: true tags: ghcr.io/${{ github.repository }}:${{steps.dependencies.outputs.VERSION}} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9a14f33..d9eb5a8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,6 +13,7 @@ env: ORAS_VERSION: 1.0.0 TERRAFORM_VERSION: 1.9.0 PALETTE_REGISTRY_CLI_VERSION: 4.3.0 + K9S_VERSION: 0.32.5 concurrency: group: docker-${{ github.ref }} @@ -77,3 +78,4 @@ jobs: ORAS_VERSION=${{env.ORAS_VERSION}} TERRAFORM_VERSION=${{env.TERRAFORM_VERSION}} PALETTE_REGISTRY_CLI_VERSION=${{env.PALETTE_REGISTRY_CLI_VERSION}} + K9S_VERSION=${{env.K9S_VERSION}} diff --git a/Dockerfile b/Dockerfile index c92b646..cabe3ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,7 @@ ARG PALETTE_REGISTRY_CLI_VERSION ARG PACKER_VERSION ARG ORAS_VERSION ARG TERRAFORM_VERSION +ARG K9S_VERSION ENV REGISTRY_LOG_LEVEL=info ENV REGISTRY_AUTH=htpasswd @@ -67,7 +68,7 @@ RUN wget https://spectro-cli.s3.amazonaws.com/v$PALETTE_REGISTRY_CLI_VERSION/li chown appuser: /home/appuser && \ mkdir -p /home/appuser/.config/k9s && \ mkdir -p /home/appuser/etc/xdg/k9s && \ - wget https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_Linux_amd64.tar.gz -O - | tar -xz -C /usr/local/bin && \ + wget https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_amd64.tar.gz -O - | tar -xz -C /usr/local/bin && \ rm -rf k9s_Linux_amd64.tar && \ wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \ unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin && \ diff --git a/Makefile b/Makefile index 3c56833..3d48f9a 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,9 @@ build-docker: ## Build docker image --build-arg PALETTE_CLI_VERSION=$(PALETTE_CLI_VERION) \ --build-arg PALETTE_EDGE_VERSION=$(PALETTE_EDGE_VERSION) \ --build-arg PACKER_VERSION=$(PACKER_VERSION) \ - --build-arg ORAS_VERSION=$(PACKER_VERSION) \ + --build-arg ORAS_VERSION=$(ORAS_VERSION) \ --build-arg TERRAFORM_VERSION=$(TERRAFORM_VERSION) \ + --build-arg K9S_VERSION=$(K9S_VERSION) \ -t tutorials . diff --git a/docs/docker.md b/docs/docker.md index 2a9c8e7..23a2c08 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -60,8 +60,8 @@ registry serve /etc/spectro/config.yml > /var/log/registry.log 2>&1 & # Local Builds -If you want to build the docker image locally, you must provide the build arguments for `PALETTE_VERSION`, `PALETTE_CLI_VERSION`, `PALETTE_EDGE_VERSION`, `PACKER_VERSION`, `ORAS_VERSION`, and `TERRAFORM_VERSION`. Use the following command to build a local image and replace the versions as needed. +If you want to build the docker image locally, you must provide the build arguments for `PALETTE_VERSION`, `PALETTE_CLI_VERSION`, `PALETTE_EDGE_VERSION`, `PACKER_VERSION`, `ORAS_VERSION`, `TERRAFORM_VERSION`, and `K9S_VERSION`. Use the following command to build a local image and replace the versions as needed. ```shell -docker build --build-arg PALETTE_VERSION=4.0.2 --build-arg PALETTE_CLI_VERSION=4.4.0 --build-arg PALETTE_EDGE_VERSION=4.4.2 --build-arg PACKER_VERSION=1.11.0 --build-arg ORAS_VERSION=1.0.0 --build-arg PALETTE_REGISTRY_CLI_VERSION=4.3.0 --build-arg TERRAFORM_VERSION=1.9.0 -t tutorials . +docker build --build-arg PALETTE_VERSION=4.0.2 --build-arg PALETTE_CLI_VERSION=4.4.0 --build-arg PALETTE_EDGE_VERSION=4.4.2 --build-arg PACKER_VERSION=1.11.0 --build-arg ORAS_VERSION=1.0.0 --build-arg PALETTE_REGISTRY_CLI_VERSION=4.3.0 --build-arg TERRAFORM_VERSION=1.9.0 --build-arg K9S_VERSION=0.32.5 -t tutorials . ``` diff --git a/terraform/getting-started-deployment-tf/README.md b/terraform/getting-started-deployment-tf/README.md index 26b4ca4..ef654d1 100644 --- a/terraform/getting-started-deployment-tf/README.md +++ b/terraform/getting-started-deployment-tf/README.md @@ -2,10 +2,10 @@ This folder contains the demo code for the **Getting Started Cluster Management with Terraform** tutorials. -- [Cluster Management with Terraform - AWS](https://docs.spectrocloud.com/getting-started/aws/manage-cluster-tf) + The Terraform code has four main toggle variables that you can use to deploy to one of the following cloud providers. @@ -21,23 +21,24 @@ The Terraform code has four main toggle variables that you can use to deploy to To get started, open the **terraform.tfvars** file. Toggle the provider variable as specified in the table and provide values to your cloud provider variables, replacing all instances of the string `REPLACE ME`. + ## Requirements -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.9 | -| [local](#requirement\_local) | 2.4.1 | -| [spectrocloud](#requirement\_spectrocloud) | >= 0.19.0-pre | -| [tls](#requirement\_tls) | 4.0.4 | -| [vsphere](#requirement\_vsphere) | >= 2.6.1 | +| Name | Version | +| --------------------------------------------------------------------------------- | ------------- | +| [terraform](#requirement_terraform) | >= 1.9 | +| [local](#requirement_local) | 2.4.1 | +| [spectrocloud](#requirement_spectrocloud) | >= 0.19.0-pre | +| [tls](#requirement_tls) | 4.0.4 | +| [vsphere](#requirement_vsphere) | >= 2.6.1 | ## Providers -| Name | Version | -|------|---------| -| [local](#provider\_local) | 2.4.1 | -| [spectrocloud](#provider\_spectrocloud) | 0.20.6 | -| [tls](#provider\_tls) | 4.0.4 | +| Name | Version | +| --------------------------------------------------------------------------- | ------- | +| [local](#provider_local) | 2.4.1 | +| [spectrocloud](#provider_spectrocloud) | 0.20.6 | +| [tls](#provider_tls) | 4.0.4 | ## Modules @@ -45,113 +46,114 @@ No modules. ## Resources -| Name | Type | -|------|------| -| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | -| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | -| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | -| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | -| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | -| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.aws-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | -| [spectrocloud_privatecloudgateway_ippool.ippool](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/privatecloudgateway_ippool) | resource | -| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | -| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | -| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | -| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | -| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_private_cloud_gateway.pcg](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/private_cloud_gateway) | data source | -| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | -| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| Name | Type | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | +| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | +| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | +| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | +| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | +| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.aws-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | +| [spectrocloud_privatecloudgateway_ippool.ippool](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/privatecloudgateway_ippool) | resource | +| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | +| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | +| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | +| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | +| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_private_cloud_gateway.pcg](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/private_cloud_gateway) | data source | +| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | ## Inputs -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [app\_namespace](#input\_app\_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes | -| [app\_port](#input\_app\_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes | -| [auth\_token](#input\_auth\_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes | -| [aws-cloud-account-name](#input\_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | n/a | yes | -| [aws-key-pair-name](#input\_aws-key-pair-name) | The name of the AWS key pair to use for SSH access to the cluster. | `string` | n/a | yes | -| [aws-region](#input\_aws-region) | AWS region | `string` | `"us-east-1"` | no | -| [aws\_control\_plane\_nodes](#input\_aws\_control\_plane\_nodes) | AWS control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | -| [aws\_worker\_nodes](#input\_aws\_worker\_nodes) | AWS worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | -| [azure-cloud-account-name](#input\_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no | -| [azure-region](#input\_azure-region) | Azure region. | `string` | `"eastus"` | no | -| [azure-use-azs](#input\_azure-use-azs) | A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource. | `bool` | n/a | yes | -| [azure\_control\_plane\_nodes](#input\_azure\_control\_plane\_nodes) | Azure control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | -| [azure\_resource\_group](#input\_azure\_resource\_group) | Azure resource group. | `string` | `""` | no | -| [azure\_subscription\_id](#input\_azure\_subscription\_id) | Azure subscription ID. | `string` | `""` | no | -| [azure\_worker\_nodes](#input\_azure\_worker\_nodes) | Azure worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | -| [datacenter\_name](#input\_datacenter\_name) | The name of the datacenter in vSphere. | `string` | n/a | yes | -| [datastore\_name](#input\_datastore\_name) | The name of the vSphere datastore. | `string` | n/a | yes | -| [db\_password](#input\_db\_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | -| [deploy-aws](#input\_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | -| [deploy-aws-kubecost](#input\_deploy-aws-kubecost) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | -| [deploy-azure](#input\_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | -| [deploy-azure-kubecost](#input\_deploy-azure-kubecost) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | -| [deploy-gcp](#input\_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | -| [deploy-gcp-kubecost](#input\_deploy-gcp-kubecost) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | -| [deploy-vmware](#input\_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | -| [deploy-vmware-kubecost](#input\_deploy-vmware-kubecost) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | -| [deploy-vmware-static](#input\_deploy-vmware-static) | A flag for enabling a deployment on VMware using static IP placement. | `bool` | n/a | yes | -| [folder\_name](#input\_folder\_name) | The name of the folder in vSphere. | `string` | n/a | yes | -| [gcp-cloud-account-name](#input\_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | -| [gcp-region](#input\_gcp-region) | GCP region | `string` | `"us-central1"` | no | -| [gcp\_control\_plane\_nodes](#input\_gcp\_control\_plane\_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | -| [gcp\_project\_name](#input\_gcp\_project\_name) | The name of your GCP project. | `string` | `""` | no | -| [gcp\_worker\_nodes](#input\_gcp\_worker\_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | -| [ip\_range\_end](#input\_ip\_range\_end) | The last IP address of your PCG IP pool range. | `string` | n/a | yes | -| [ip\_range\_start](#input\_ip\_range\_start) | The first IP address of your PCG IP pool range. | `string` | n/a | yes | -| [metallb\_ip](#input\_metallb\_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | -| [nameserver\_addr](#input\_nameserver\_addr) | A comma-separated list of DNS nameserver IP addresses of your network. | `set(string)` | n/a | yes | -| [network\_gateway](#input\_network\_gateway) | The IP address of the vSphere network gateway. | `string` | n/a | yes | -| [network\_name](#input\_network\_name) | The name of the vSphere network. | `string` | n/a | yes | -| [network\_prefix](#input\_network\_prefix) | The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. | `number` | n/a | yes | -| [palette-project](#input\_palette-project) | The name of your project in Palette. | `string` | n/a | yes | -| [pcg\_name](#input\_pcg\_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | -| [replicas\_number](#input\_replicas\_number) | The number of pods to be created. | `number` | n/a | yes | -| [resource\_pool\_name](#input\_resource\_pool\_name) | The name of the vSphere resource pool. | `string` | n/a | yes | -| [search\_domain](#input\_search\_domain) | The name of network search domain. | `string` | n/a | yes | -| [ssh\_key](#input\_ssh\_key) | The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | -| [ssh\_key\_private](#input\_ssh\_key\_private) | The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | -| [tags](#input\_tags) | The default tags to apply to Palette resources. | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"repository:spectrocloud:tutorials",
"terraform_managed:true",
"tutorial:getting-started-terraform"
]
| no | -| [vsphere\_cluster](#input\_vsphere\_cluster) | The name of your vSphere cluster. | `string` | n/a | yes | +| Name | Description | Type | Default | Required | +| ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | +| [app_namespace](#input_app_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes | +| [app_port](#input_app_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes | +| [auth_token](#input_auth_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes | +| [aws-cloud-account-name](#input_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | n/a | yes | +| [aws-key-pair-name](#input_aws-key-pair-name) | The name of the AWS key pair to use for SSH access to the cluster. | `string` | n/a | yes | +| [aws-region](#input_aws-region) | AWS region | `string` | `"us-east-1"` | no | +| [aws_control_plane_nodes](#input_aws_control_plane_nodes) | AWS control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [aws_worker_nodes](#input_aws_worker_nodes) | AWS worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [azure-cloud-account-name](#input_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no | +| [azure-region](#input_azure-region) | Azure region. | `string` | `"eastus"` | no | +| [azure-use-azs](#input_azure-use-azs) | A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource. | `bool` | n/a | yes | +| [azure_control_plane_nodes](#input_azure_control_plane_nodes) | Azure control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [azure_resource_group](#input_azure_resource_group) | Azure resource group. | `string` | `""` | no | +| [azure_subscription_id](#input_azure_subscription_id) | Azure subscription ID. | `string` | `""` | no | +| [azure_worker_nodes](#input_azure_worker_nodes) | Azure worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [datacenter_name](#input_datacenter_name) | The name of the datacenter in vSphere. | `string` | n/a | yes | +| [datastore_name](#input_datastore_name) | The name of the vSphere datastore. | `string` | n/a | yes | +| [db_password](#input_db_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | +| [deploy-aws](#input_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | +| [deploy-aws-kubecost](#input_deploy-aws-kubecost) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | +| [deploy-azure](#input_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | +| [deploy-azure-kubecost](#input_deploy-azure-kubecost) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | +| [deploy-gcp](#input_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | +| [deploy-gcp-kubecost](#input_deploy-gcp-kubecost) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware](#input_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | +| [deploy-vmware-kubecost](#input_deploy-vmware-kubecost) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware-static](#input_deploy-vmware-static) | A flag for enabling a deployment on VMware using static IP placement. | `bool` | n/a | yes | +| [folder_name](#input_folder_name) | The name of the folder in vSphere. | `string` | n/a | yes | +| [gcp-cloud-account-name](#input_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | +| [gcp-region](#input_gcp-region) | GCP region | `string` | `"us-central1"` | no | +| [gcp_control_plane_nodes](#input_gcp_control_plane_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [gcp_project_name](#input_gcp_project_name) | The name of your GCP project. | `string` | `""` | no | +| [gcp_worker_nodes](#input_gcp_worker_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [ip_range_end](#input_ip_range_end) | The last IP address of your PCG IP pool range. | `string` | n/a | yes | +| [ip_range_start](#input_ip_range_start) | The first IP address of your PCG IP pool range. | `string` | n/a | yes | +| [metallb_ip](#input_metallb_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | +| [nameserver_addr](#input_nameserver_addr) | A comma-separated list of DNS nameserver IP addresses of your network. | `set(string)` | n/a | yes | +| [network_gateway](#input_network_gateway) | The IP address of the vSphere network gateway. | `string` | n/a | yes | +| [network_name](#input_network_name) | The name of the vSphere network. | `string` | n/a | yes | +| [network_prefix](#input_network_prefix) | The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. | `number` | n/a | yes | +| [palette-project](#input_palette-project) | The name of your project in Palette. | `string` | n/a | yes | +| [pcg_name](#input_pcg_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | +| [replicas_number](#input_replicas_number) | The number of pods to be created. | `number` | n/a | yes | +| [resource_pool_name](#input_resource_pool_name) | The name of the vSphere resource pool. | `string` | n/a | yes | +| [search_domain](#input_search_domain) | The name of network search domain. | `string` | n/a | yes | +| [ssh_key](#input_ssh_key) | The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [ssh_key_private](#input_ssh_key_private) | The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [tags](#input_tags) | The default tags to apply to Palette resources. | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"repository:spectrocloud:tutorials",
"terraform_managed:true",
"tutorial:getting-started-terraform"
]
| no | +| [vsphere_cluster](#input_vsphere_cluster) | The name of your vSphere cluster. | `string` | n/a | yes | ## Outputs -| Name | Description | -|------|-------------| -| [Advisory](#output\_Advisory) | n/a | -| [ssh\_connection\_command](#output\_ssh\_connection\_command) | Command to use the generated private SSH key to access the nodes. | -| [ssh\_connection\_command\_user](#output\_ssh\_connection\_command\_user) | Command to use the user's private SSH key to access the nodes. | -| [ssh\_key\_location](#output\_ssh\_key\_location) | Location of the generated private SSH key file. | -| [ssh\_public\_key\_location](#output\_ssh\_public\_key\_location) | Location of the generated public SSH key file. | +| Name | Description | +| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | +| [Advisory](#output_Advisory) | n/a | +| [ssh_connection_command](#output_ssh_connection_command) | Command to use the generated private SSH key to access the nodes. | +| [ssh_connection_command_user](#output_ssh_connection_command_user) | Command to use the user's private SSH key to access the nodes. | +| [ssh_key_location](#output_ssh_key_location) | Location of the generated private SSH key file. | +| [ssh_public_key_location](#output_ssh_public_key_location) | Location of the generated public SSH key file. | + From db6a5937897b990001e729a8de30a113578d65c7 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Tue, 9 Jul 2024 11:50:19 -0400 Subject: [PATCH 07/12] fix: update spectro provider version, cluster profile logic, and broken tag --- .../getting-started-deployment-tf/README.md | 232 +++++++++--------- .../cluster_profiles.tf | 54 +++- .../getting-started-deployment-tf/inputs.tf | 2 +- .../getting-started-deployment-tf/provider.tf | 2 +- 4 files changed, 167 insertions(+), 123 deletions(-) diff --git a/terraform/getting-started-deployment-tf/README.md b/terraform/getting-started-deployment-tf/README.md index ef654d1..1760396 100644 --- a/terraform/getting-started-deployment-tf/README.md +++ b/terraform/getting-started-deployment-tf/README.md @@ -21,24 +21,23 @@ The Terraform code has four main toggle variables that you can use to deploy to To get started, open the **terraform.tfvars** file. Toggle the provider variable as specified in the table and provide values to your cloud provider variables, replacing all instances of the string `REPLACE ME`. - ## Requirements -| Name | Version | -| --------------------------------------------------------------------------------- | ------------- | -| [terraform](#requirement_terraform) | >= 1.9 | -| [local](#requirement_local) | 2.4.1 | -| [spectrocloud](#requirement_spectrocloud) | >= 0.19.0-pre | -| [tls](#requirement_tls) | 4.0.4 | -| [vsphere](#requirement_vsphere) | >= 2.6.1 | +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.9 | +| [local](#requirement\_local) | 2.4.1 | +| [spectrocloud](#requirement\_spectrocloud) | >= 0.20.6 | +| [tls](#requirement\_tls) | 4.0.4 | +| [vsphere](#requirement\_vsphere) | >= 2.6.1 | ## Providers -| Name | Version | -| --------------------------------------------------------------------------- | ------- | -| [local](#provider_local) | 2.4.1 | -| [spectrocloud](#provider_spectrocloud) | 0.20.6 | -| [tls](#provider_tls) | 4.0.4 | +| Name | Version | +|------|---------| +| [local](#provider\_local) | 2.4.1 | +| [spectrocloud](#provider\_spectrocloud) | 0.20.6 | +| [tls](#provider\_tls) | 4.0.4 | ## Modules @@ -46,114 +45,113 @@ No modules. ## Resources -| Name | Type | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | -| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | -| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | -| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | -| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | -| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.aws-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.azure-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.gcp-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_profile.vmware-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | -| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | -| [spectrocloud_privatecloudgateway_ippool.ippool](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/privatecloudgateway_ippool) | resource | -| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | -| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | -| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | -| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | -| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | -| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | -| [spectrocloud_private_cloud_gateway.pcg](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/private_cloud_gateway) | data source | -| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | -| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| Name | Type | +|------|------| +| [local_file.public_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/file) | resource | +| [local_sensitive_file.private_key_file](https://registry.terraform.io/providers/hashicorp/local/2.4.1/docs/resources/sensitive_file) | resource | +| [spectrocloud_cluster_aws.aws-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource | +| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource | +| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource | +| [spectrocloud_cluster_profile.aws-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.aws-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.azure-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.gcp-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_profile.vmware-profile-kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource | +| [spectrocloud_cluster_vsphere.vmware-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_vsphere) | resource | +| [spectrocloud_privatecloudgateway_ippool.ippool](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/privatecloudgateway_ippool) | resource | +| [tls_private_key.tutorial_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source | +| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source | +| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source | +| [spectrocloud_cloudaccount_vsphere.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_vsphere) | data source | +| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.kubecost](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_pack.vmware_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source | +| [spectrocloud_private_cloud_gateway.pcg](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/private_cloud_gateway) | data source | +| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | +| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source | ## Inputs -| Name | Description | Type | Default | Required | -| ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | -| [app_namespace](#input_app_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes | -| [app_port](#input_app_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes | -| [auth_token](#input_auth_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes | -| [aws-cloud-account-name](#input_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | n/a | yes | -| [aws-key-pair-name](#input_aws-key-pair-name) | The name of the AWS key pair to use for SSH access to the cluster. | `string` | n/a | yes | -| [aws-region](#input_aws-region) | AWS region | `string` | `"us-east-1"` | no | -| [aws_control_plane_nodes](#input_aws_control_plane_nodes) | AWS control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | -| [aws_worker_nodes](#input_aws_worker_nodes) | AWS worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | -| [azure-cloud-account-name](#input_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no | -| [azure-region](#input_azure-region) | Azure region. | `string` | `"eastus"` | no | -| [azure-use-azs](#input_azure-use-azs) | A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource. | `bool` | n/a | yes | -| [azure_control_plane_nodes](#input_azure_control_plane_nodes) | Azure control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | -| [azure_resource_group](#input_azure_resource_group) | Azure resource group. | `string` | `""` | no | -| [azure_subscription_id](#input_azure_subscription_id) | Azure subscription ID. | `string` | `""` | no | -| [azure_worker_nodes](#input_azure_worker_nodes) | Azure worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | -| [datacenter_name](#input_datacenter_name) | The name of the datacenter in vSphere. | `string` | n/a | yes | -| [datastore_name](#input_datastore_name) | The name of the vSphere datastore. | `string` | n/a | yes | -| [db_password](#input_db_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | -| [deploy-aws](#input_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | -| [deploy-aws-kubecost](#input_deploy-aws-kubecost) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | -| [deploy-azure](#input_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | -| [deploy-azure-kubecost](#input_deploy-azure-kubecost) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | -| [deploy-gcp](#input_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | -| [deploy-gcp-kubecost](#input_deploy-gcp-kubecost) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | -| [deploy-vmware](#input_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | -| [deploy-vmware-kubecost](#input_deploy-vmware-kubecost) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | -| [deploy-vmware-static](#input_deploy-vmware-static) | A flag for enabling a deployment on VMware using static IP placement. | `bool` | n/a | yes | -| [folder_name](#input_folder_name) | The name of the folder in vSphere. | `string` | n/a | yes | -| [gcp-cloud-account-name](#input_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | -| [gcp-region](#input_gcp-region) | GCP region | `string` | `"us-central1"` | no | -| [gcp_control_plane_nodes](#input_gcp_control_plane_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | -| [gcp_project_name](#input_gcp_project_name) | The name of your GCP project. | `string` | `""` | no | -| [gcp_worker_nodes](#input_gcp_worker_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | -| [ip_range_end](#input_ip_range_end) | The last IP address of your PCG IP pool range. | `string` | n/a | yes | -| [ip_range_start](#input_ip_range_start) | The first IP address of your PCG IP pool range. | `string` | n/a | yes | -| [metallb_ip](#input_metallb_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | -| [nameserver_addr](#input_nameserver_addr) | A comma-separated list of DNS nameserver IP addresses of your network. | `set(string)` | n/a | yes | -| [network_gateway](#input_network_gateway) | The IP address of the vSphere network gateway. | `string` | n/a | yes | -| [network_name](#input_network_name) | The name of the vSphere network. | `string` | n/a | yes | -| [network_prefix](#input_network_prefix) | The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. | `number` | n/a | yes | -| [palette-project](#input_palette-project) | The name of your project in Palette. | `string` | n/a | yes | -| [pcg_name](#input_pcg_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | -| [replicas_number](#input_replicas_number) | The number of pods to be created. | `number` | n/a | yes | -| [resource_pool_name](#input_resource_pool_name) | The name of the vSphere resource pool. | `string` | n/a | yes | -| [search_domain](#input_search_domain) | The name of network search domain. | `string` | n/a | yes | -| [ssh_key](#input_ssh_key) | The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | -| [ssh_key_private](#input_ssh_key_private) | The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | -| [tags](#input_tags) | The default tags to apply to Palette resources. | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"repository:spectrocloud:tutorials",
"terraform_managed:true",
"tutorial:getting-started-terraform"
]
| no | -| [vsphere_cluster](#input_vsphere_cluster) | The name of your vSphere cluster. | `string` | n/a | yes | +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [app\_namespace](#input\_app\_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes | +| [app\_port](#input\_app\_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes | +| [auth\_token](#input\_auth\_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes | +| [aws-cloud-account-name](#input\_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | n/a | yes | +| [aws-key-pair-name](#input\_aws-key-pair-name) | The name of the AWS key pair to use for SSH access to the cluster. | `string` | n/a | yes | +| [aws-region](#input\_aws-region) | AWS region | `string` | `"us-east-1"` | no | +| [aws\_control\_plane\_nodes](#input\_aws\_control\_plane\_nodes) | AWS control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [aws\_worker\_nodes](#input\_aws\_worker\_nodes) | AWS worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-east-1a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "m4.2xlarge"
}
| no | +| [azure-cloud-account-name](#input\_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no | +| [azure-region](#input\_azure-region) | Azure region. | `string` | `"eastus"` | no | +| [azure-use-azs](#input\_azure-use-azs) | A flag for configuring whether to use Azure Availability Zones. Check if your Azure region supports availability zones by reviewing the [Azure Regions and Availability Zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support) resource. | `bool` | n/a | yes | +| [azure\_control\_plane\_nodes](#input\_azure\_control\_plane\_nodes) | Azure control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [azure\_resource\_group](#input\_azure\_resource\_group) | Azure resource group. | `string` | `""` | no | +| [azure\_subscription\_id](#input\_azure\_subscription\_id) | Azure subscription ID. | `string` | `""` | no | +| [azure\_worker\_nodes](#input\_azure\_worker\_nodes) | Azure worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
azs = list(string)
is_system_node_pool = bool
})
|
{
"azs": [
"1"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "Standard_A8_v2",
"is_system_node_pool": false
}
| no | +| [datacenter\_name](#input\_datacenter\_name) | The name of the datacenter in vSphere. | `string` | n/a | yes | +| [datastore\_name](#input\_datastore\_name) | The name of the vSphere datastore. | `string` | n/a | yes | +| [db\_password](#input\_db\_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes | +| [deploy-aws](#input\_deploy-aws) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes | +| [deploy-aws-kubecost](#input\_deploy-aws-kubecost) | A flag for enabling a deployment on AWS with Kubecost. | `bool` | n/a | yes | +| [deploy-azure](#input\_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes | +| [deploy-azure-kubecost](#input\_deploy-azure-kubecost) | A flag for enabling a deployment on Azure with Kubecost. | `bool` | n/a | yes | +| [deploy-gcp](#input\_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes | +| [deploy-gcp-kubecost](#input\_deploy-gcp-kubecost) | A flag for enabling a deployment on GCP with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware](#input\_deploy-vmware) | A flag for enabling a deployment on VMware. | `bool` | n/a | yes | +| [deploy-vmware-kubecost](#input\_deploy-vmware-kubecost) | A flag for enabling a deployment on VMware with Kubecost. | `bool` | n/a | yes | +| [deploy-vmware-static](#input\_deploy-vmware-static) | A flag for enabling a deployment on VMware using static IP placement. | `bool` | n/a | yes | +| [folder\_name](#input\_folder\_name) | The name of the folder in vSphere. | `string` | n/a | yes | +| [gcp-cloud-account-name](#input\_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no | +| [gcp-region](#input\_gcp-region) | GCP region | `string` | `"us-central1"` | no | +| [gcp\_control\_plane\_nodes](#input\_gcp\_control\_plane\_nodes) | GCP control plane nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": true,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [gcp\_project\_name](#input\_gcp\_project\_name) | The name of your GCP project. | `string` | `""` | no | +| [gcp\_worker\_nodes](#input\_gcp\_worker\_nodes) | GCP worker nodes configuration. |
object({
count = string
control_plane = bool
instance_type = string
disk_size_gb = string
availability_zones = list(string)
})
|
{
"availability_zones": [
"us-central1-a"
],
"control_plane": false,
"count": "1",
"disk_size_gb": "60",
"instance_type": "n1-standard-4"
}
| no | +| [ip\_range\_end](#input\_ip\_range\_end) | The last IP address of your PCG IP pool range. | `string` | n/a | yes | +| [ip\_range\_start](#input\_ip\_range\_start) | The first IP address of your PCG IP pool range. | `string` | n/a | yes | +| [metallb\_ip](#input\_metallb\_ip) | The IP address range for your MetalLB load balancer. | `string` | n/a | yes | +| [nameserver\_addr](#input\_nameserver\_addr) | A comma-separated list of DNS nameserver IP addresses of your network. | `set(string)` | n/a | yes | +| [network\_gateway](#input\_network\_gateway) | The IP address of the vSphere network gateway. | `string` | n/a | yes | +| [network\_name](#input\_network\_name) | The name of the vSphere network. | `string` | n/a | yes | +| [network\_prefix](#input\_network\_prefix) | The prefix of your vSphere network. Valid values are network CIDR subnet masks from the range 0-32. Example: 18. | `number` | n/a | yes | +| [palette-project](#input\_palette-project) | The name of your project in Palette. | `string` | n/a | yes | +| [pcg\_name](#input\_pcg\_name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | +| [replicas\_number](#input\_replicas\_number) | The number of pods to be created. | `number` | n/a | yes | +| [resource\_pool\_name](#input\_resource\_pool\_name) | The name of the vSphere resource pool. | `string` | n/a | yes | +| [search\_domain](#input\_search\_domain) | The name of network search domain. | `string` | n/a | yes | +| [ssh\_key](#input\_ssh\_key) | The path to the public key that will be added to the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [ssh\_key\_private](#input\_ssh\_key\_private) | The path to the private key that will be used to access the cluster nodes. If not provided, a new key pair will be generated. | `string` | n/a | yes | +| [tags](#input\_tags) | The default tags to apply to Palette resources. | `list(string)` |
[
"spectro-cloud-education",
"app:hello-universe",
"spectrocloud:tutorials",
"terraform_managed:true",
"tutorial:getting-started-terraform"
]
| no | +| [vsphere\_cluster](#input\_vsphere\_cluster) | The name of your vSphere cluster. | `string` | n/a | yes | ## Outputs -| Name | Description | -| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -| [Advisory](#output_Advisory) | n/a | -| [ssh_connection_command](#output_ssh_connection_command) | Command to use the generated private SSH key to access the nodes. | -| [ssh_connection_command_user](#output_ssh_connection_command_user) | Command to use the user's private SSH key to access the nodes. | -| [ssh_key_location](#output_ssh_key_location) | Location of the generated private SSH key file. | -| [ssh_public_key_location](#output_ssh_public_key_location) | Location of the generated public SSH key file. | - +| Name | Description | +|------|-------------| +| [Advisory](#output\_Advisory) | n/a | +| [ssh\_connection\_command](#output\_ssh\_connection\_command) | Command to use the generated private SSH key to access the nodes. | +| [ssh\_connection\_command\_user](#output\_ssh\_connection\_command\_user) | Command to use the user's private SSH key to access the nodes. | +| [ssh\_key\_location](#output\_ssh\_key\_location) | Location of the generated private SSH key file. | +| [ssh\_public\_key\_location](#output\_ssh\_public\_key\_location) | Location of the generated public SSH key file. | diff --git a/terraform/getting-started-deployment-tf/cluster_profiles.tf b/terraform/getting-started-deployment-tf/cluster_profiles.tf index 2a21bf7..3f47575 100644 --- a/terraform/getting-started-deployment-tf/cluster_profiles.tf +++ b/terraform/getting-started-deployment-tf/cluster_profiles.tf @@ -19,6 +19,7 @@ resource "spectrocloud_cluster_profile" "aws-profile" { tag = data.spectrocloud_pack.aws_ubuntu.version uid = data.spectrocloud_pack.aws_ubuntu.id values = data.spectrocloud_pack.aws_ubuntu.values + type = "spectro" } pack { @@ -26,6 +27,7 @@ resource "spectrocloud_cluster_profile" "aws-profile" { tag = data.spectrocloud_pack.aws_k8s.version uid = data.spectrocloud_pack.aws_k8s.id values = data.spectrocloud_pack.aws_k8s.values + type = "spectro" } pack { @@ -33,6 +35,7 @@ resource "spectrocloud_cluster_profile" "aws-profile" { tag = data.spectrocloud_pack.aws_cni.version uid = data.spectrocloud_pack.aws_cni.id values = data.spectrocloud_pack.aws_cni.values + type = "spectro" } pack { @@ -40,6 +43,7 @@ resource "spectrocloud_cluster_profile" "aws-profile" { tag = data.spectrocloud_pack.aws_csi.version uid = data.spectrocloud_pack.aws_csi.id values = data.spectrocloud_pack.aws_csi.values + type = "spectro" } pack { @@ -53,6 +57,7 @@ resource "spectrocloud_cluster_profile" "aws-profile" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } } @@ -60,7 +65,7 @@ resource "spectrocloud_cluster_profile" "aws-profile" { # AWS Cluster Profile v1.1.0 ############################ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { - count = var.deploy-aws-kubecost ? 1 : 0 + count = var.deploy-aws ? 1 : 0 name = "tf-aws-profile" description = "A basic cluster profile for AWS with Kubecost" @@ -74,6 +79,7 @@ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { tag = data.spectrocloud_pack.aws_ubuntu.version uid = data.spectrocloud_pack.aws_ubuntu.id values = data.spectrocloud_pack.aws_ubuntu.values + type = "spectro" } pack { @@ -81,6 +87,7 @@ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { tag = data.spectrocloud_pack.aws_k8s.version uid = data.spectrocloud_pack.aws_k8s.id values = data.spectrocloud_pack.aws_k8s.values + type = "spectro" } pack { @@ -88,6 +95,7 @@ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { tag = data.spectrocloud_pack.aws_cni.version uid = data.spectrocloud_pack.aws_cni.id values = data.spectrocloud_pack.aws_cni.values + type = "spectro" } pack { @@ -95,6 +103,7 @@ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { tag = data.spectrocloud_pack.aws_csi.version uid = data.spectrocloud_pack.aws_csi.id values = data.spectrocloud_pack.aws_csi.values + type = "spectro" } pack { @@ -108,6 +117,7 @@ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } pack { @@ -115,6 +125,7 @@ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { tag = data.spectrocloud_pack.kubecost.version uid = data.spectrocloud_pack.kubecost.id values = data.spectrocloud_pack.kubecost.values + type = "oci" } } @@ -136,6 +147,7 @@ resource "spectrocloud_cluster_profile" "azure-profile" { tag = data.spectrocloud_pack.azure_ubuntu.version uid = data.spectrocloud_pack.azure_ubuntu.id values = data.spectrocloud_pack.azure_ubuntu.values + type = "spectro" } pack { @@ -143,6 +155,7 @@ resource "spectrocloud_cluster_profile" "azure-profile" { tag = data.spectrocloud_pack.azure_k8s.version uid = data.spectrocloud_pack.azure_k8s.id values = data.spectrocloud_pack.azure_k8s.values + type = "spectro" } pack { @@ -150,6 +163,7 @@ resource "spectrocloud_cluster_profile" "azure-profile" { tag = data.spectrocloud_pack.azure_cni.version uid = data.spectrocloud_pack.azure_cni.id values = data.spectrocloud_pack.azure_cni.values + type = "spectro" } pack { @@ -157,6 +171,7 @@ resource "spectrocloud_cluster_profile" "azure-profile" { tag = data.spectrocloud_pack.azure_csi.version uid = data.spectrocloud_pack.azure_csi.id values = data.spectrocloud_pack.azure_csi.values + type = "spectro" } pack { @@ -170,6 +185,7 @@ resource "spectrocloud_cluster_profile" "azure-profile" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } } @@ -177,7 +193,7 @@ resource "spectrocloud_cluster_profile" "azure-profile" { # Azure Cluster Profile v1.1.0 ############################## resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { - count = var.deploy-azure-kubecost ? 1 : 0 + count = var.deploy-azure ? 1 : 0 name = "tf-azure-profile" description = "A basic cluster profile for Azure with Kubecost" @@ -191,6 +207,7 @@ resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { tag = data.spectrocloud_pack.azure_ubuntu.version uid = data.spectrocloud_pack.azure_ubuntu.id values = data.spectrocloud_pack.azure_ubuntu.values + type = "spectro" } pack { @@ -198,6 +215,7 @@ resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { tag = data.spectrocloud_pack.azure_k8s.version uid = data.spectrocloud_pack.azure_k8s.id values = data.spectrocloud_pack.azure_k8s.values + type = "spectro" } pack { @@ -205,6 +223,7 @@ resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { tag = data.spectrocloud_pack.azure_cni.version uid = data.spectrocloud_pack.azure_cni.id values = data.spectrocloud_pack.azure_cni.values + type = "spectro" } pack { @@ -212,6 +231,7 @@ resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { tag = data.spectrocloud_pack.azure_csi.version uid = data.spectrocloud_pack.azure_csi.id values = data.spectrocloud_pack.azure_csi.values + type = "spectro" } pack { @@ -225,6 +245,7 @@ resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } pack { @@ -232,6 +253,7 @@ resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { tag = data.spectrocloud_pack.kubecost.version uid = data.spectrocloud_pack.kubecost.id values = data.spectrocloud_pack.kubecost.values + type = "oci" } } @@ -254,6 +276,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { tag = data.spectrocloud_pack.gcp_ubuntu.version uid = data.spectrocloud_pack.gcp_ubuntu.id values = data.spectrocloud_pack.gcp_ubuntu.values + type = "spectro" } pack { @@ -261,6 +284,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { tag = data.spectrocloud_pack.gcp_k8s.version uid = data.spectrocloud_pack.gcp_k8s.id values = data.spectrocloud_pack.gcp_k8s.values + type = "spectro" } pack { @@ -268,6 +292,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { tag = data.spectrocloud_pack.gcp_cni.version uid = data.spectrocloud_pack.gcp_cni.id values = data.spectrocloud_pack.gcp_cni.values + type = "spectro" } pack { @@ -275,6 +300,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { tag = data.spectrocloud_pack.gcp_csi.version uid = data.spectrocloud_pack.gcp_csi.id values = data.spectrocloud_pack.gcp_csi.values + type = "spectro" } pack { @@ -288,6 +314,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } } @@ -295,7 +322,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { # GCP Cluster Profile v1.1.0 ############################ resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { - count = var.deploy-gcp-kubecost ? 1 : 0 + count = var.deploy-gcp ? 1 : 0 name = "tf-gcp-profile" description = "A basic cluster profile for GCP with Kubecost" @@ -309,6 +336,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { tag = data.spectrocloud_pack.gcp_ubuntu.version uid = data.spectrocloud_pack.gcp_ubuntu.id values = data.spectrocloud_pack.gcp_ubuntu.values + type = "spectro" } pack { @@ -316,6 +344,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { tag = data.spectrocloud_pack.gcp_k8s.version uid = data.spectrocloud_pack.gcp_k8s.id values = data.spectrocloud_pack.gcp_k8s.values + type = "spectro" } pack { @@ -323,6 +352,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { tag = data.spectrocloud_pack.gcp_cni.version uid = data.spectrocloud_pack.gcp_cni.id values = data.spectrocloud_pack.gcp_cni.values + type = "spectro" } pack { @@ -330,6 +360,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { tag = data.spectrocloud_pack.gcp_csi.version uid = data.spectrocloud_pack.gcp_csi.id values = data.spectrocloud_pack.gcp_csi.values + type = "spectro" } pack { @@ -343,6 +374,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } pack { @@ -350,6 +382,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile-kubecost" { tag = data.spectrocloud_pack.kubecost.version uid = data.spectrocloud_pack.kubecost.id values = data.spectrocloud_pack.kubecost.values + type = "oci" } } @@ -371,6 +404,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { tag = data.spectrocloud_pack.vmware_ubuntu.version uid = data.spectrocloud_pack.vmware_ubuntu.id values = data.spectrocloud_pack.vmware_ubuntu.values + type = "spectro" } pack { @@ -378,6 +412,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { tag = data.spectrocloud_pack.vmware_k8s.version uid = data.spectrocloud_pack.vmware_k8s.id values = data.spectrocloud_pack.vmware_k8s.values + type = "spectro" } pack { @@ -385,6 +420,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { tag = data.spectrocloud_pack.vmware_cni.version uid = data.spectrocloud_pack.vmware_cni.id values = data.spectrocloud_pack.vmware_cni.values + type = "spectro" } pack { @@ -392,6 +428,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { tag = data.spectrocloud_pack.vmware_csi.version uid = data.spectrocloud_pack.vmware_csi.id values = data.spectrocloud_pack.vmware_csi.values + type = "spectro" } pack { @@ -399,6 +436,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { tag = data.spectrocloud_pack.vmware_metallb.version uid = data.spectrocloud_pack.vmware_metallb.id values = replace(data.spectrocloud_pack.vmware_metallb.values, "192.168.10.0/24", var.metallb_ip) + type = "oci" } pack { @@ -412,6 +450,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } } @@ -419,7 +458,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { # VMware Cluster Profile v1.1.0 ############################### resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { - count = var.deploy-vmware-kubecost ? 1 : 0 + count = var.deploy-vmware ? 1 : 0 name = "tf-vmware-profile" description = "A basic cluster profile for VMware with Kubecost" @@ -433,6 +472,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { tag = data.spectrocloud_pack.vmware_ubuntu.version uid = data.spectrocloud_pack.vmware_ubuntu.id values = data.spectrocloud_pack.vmware_ubuntu.values + type = "spectro" } pack { @@ -440,6 +480,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { tag = data.spectrocloud_pack.vmware_k8s.version uid = data.spectrocloud_pack.vmware_k8s.id values = data.spectrocloud_pack.vmware_k8s.values + type = "spectro" } pack { @@ -447,6 +488,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { tag = data.spectrocloud_pack.vmware_cni.version uid = data.spectrocloud_pack.vmware_cni.id values = data.spectrocloud_pack.vmware_cni.values + type = "spectro" } pack { @@ -454,6 +496,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { tag = data.spectrocloud_pack.vmware_csi.version uid = data.spectrocloud_pack.vmware_csi.id values = data.spectrocloud_pack.vmware_csi.values + type = "spectro" } pack { @@ -461,6 +504,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { tag = data.spectrocloud_pack.vmware_metallb.version uid = data.spectrocloud_pack.vmware_metallb.id values = replace(data.spectrocloud_pack.vmware_metallb.values, "192.168.10.0/24", var.metallb_ip) + type = "spectro" } pack { @@ -474,6 +518,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) + type = "oci" } pack { @@ -481,5 +526,6 @@ resource "spectrocloud_cluster_profile" "vmware-profile-kubecost" { tag = data.spectrocloud_pack.kubecost.version uid = data.spectrocloud_pack.kubecost.id values = data.spectrocloud_pack.kubecost.values + type = "oci" } } \ No newline at end of file diff --git a/terraform/getting-started-deployment-tf/inputs.tf b/terraform/getting-started-deployment-tf/inputs.tf index 5ba2532..629893d 100644 --- a/terraform/getting-started-deployment-tf/inputs.tf +++ b/terraform/getting-started-deployment-tf/inputs.tf @@ -301,7 +301,7 @@ variable "tags" { default = [ "spectro-cloud-education", "app:hello-universe", - "repository:spectrocloud:tutorials", + "spectrocloud:tutorials", "terraform_managed:true", "tutorial:getting-started-terraform" ] diff --git a/terraform/getting-started-deployment-tf/provider.tf b/terraform/getting-started-deployment-tf/provider.tf index 6b3dda8..977dcc6 100644 --- a/terraform/getting-started-deployment-tf/provider.tf +++ b/terraform/getting-started-deployment-tf/provider.tf @@ -4,7 +4,7 @@ terraform { required_providers { spectrocloud = { - version = ">= 0.19.0-pre" + version = ">= 0.20.6" source = "spectrocloud/spectrocloud" } From d8ae3b4994a71fa685d164cf3ecfc8e4974578a6 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Fri, 12 Jul 2024 17:15:59 -0400 Subject: [PATCH 08/12] fix: metallb pack type --- terraform/getting-started-deployment-tf/cluster_profiles.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/getting-started-deployment-tf/cluster_profiles.tf b/terraform/getting-started-deployment-tf/cluster_profiles.tf index 3f47575..cee044a 100644 --- a/terraform/getting-started-deployment-tf/cluster_profiles.tf +++ b/terraform/getting-started-deployment-tf/cluster_profiles.tf @@ -436,7 +436,7 @@ resource "spectrocloud_cluster_profile" "vmware-profile" { tag = data.spectrocloud_pack.vmware_metallb.version uid = data.spectrocloud_pack.vmware_metallb.id values = replace(data.spectrocloud_pack.vmware_metallb.values, "192.168.10.0/24", var.metallb_ip) - type = "oci" + type = "spectro" } pack { From 2972eabc52d6999143c854e834a78c4cd3fc3b19 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Wed, 18 Sep 2024 09:35:09 -0400 Subject: [PATCH 09/12] docs: fix merge conflicts in dockerfile --- Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index b70885f..5294492 100644 --- a/Dockerfile +++ b/Dockerfile @@ -65,9 +65,6 @@ RUN wget https://spectro-cli.s3.amazonaws.com/v$PALETTE_REGISTRY_CLI_VERSION/li rm -rf oras_${ORAS_VERSION}_*.tar.gz oras-install/ && \ git clone https://github.com/spectrocloud/CanvOS.git && \ rm -rf /var/cache/apk/* && \ - chown appuser: /home/appuser && \ - mkdir -p /home/appuser/.config/k9s && \ - mkdir -p /home/appuser/etc/xdg/k9s && \ wget https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_amd64.tar.gz -O - | tar -xz -C /usr/local/bin && \ rm -rf k9s_Linux_amd64.tar && \ wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \ @@ -78,8 +75,8 @@ RUN wget https://spectro-cli.s3.amazonaws.com/v$PALETTE_REGISTRY_CLI_VERSION/li ADD https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip /usr/local/sbin/ RUN unzip /usr/local/sbin/packer_${PACKER_VERSION}_linux_amd64.zip -d /usr/local/sbin && \ rm -rf /usr/local/sbin/packer_${PACKER_VERSION}_linux_amd64.zip && \ - mkdir -p /home/appuser/.config/packer && mkdir /root/.spectro && \ - chown -R appuser:appuser /home/appuser/.config/packer terraform/ packs/ edge/ CanvOS/ /var/log/ /root/.spectro/ /etc/spectro/ + mkdir -p /home/appuser/.config/packer && mkdir /root/.spectro && mkdir -p /home/appuser/.config/k9s && mkdir -p /home/appuser/etc/xdg/k9s && \ + chown -R appuser:appuser /home/appuser/.config/packer terraform/ packs/ edge/ CanvOS/ /var/log/ /root/.spectro/ /etc/spectro/ /home/appuser/.config/k9s /home/appuser/etc/xdg/k9s EXPOSE 5000 USER appuser From c7b620461f8cb966a65d76d7f344a641f5772b99 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Wed, 18 Sep 2024 10:00:13 -0400 Subject: [PATCH 10/12] docs: update pack and images version --- terraform/getting-started-deployment-tf/data.tf | 2 +- .../manifests/values-3tier.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/terraform/getting-started-deployment-tf/data.tf b/terraform/getting-started-deployment-tf/data.tf index d36f996..26fd122 100644 --- a/terraform/getting-started-deployment-tf/data.tf +++ b/terraform/getting-started-deployment-tf/data.tf @@ -159,7 +159,7 @@ data "spectrocloud_private_cloud_gateway" "pcg" { data "spectrocloud_pack" "hellouniverse" { name = "hello-universe" - version = "1.1.2" + version = "1.2.0" registry_uid = data.spectrocloud_registry.community_registry.id } diff --git a/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml b/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml index eddbb4a..9fef889 100644 --- a/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml +++ b/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml @@ -4,14 +4,14 @@ pack: content: images: - - image: ghcr.io/spectrocloud/hello-universe:1.1.2 + - image: ghcr.io/spectrocloud/hello-universe:1.2.0 manifests: hello-universe: images: - hellouniverse: ghcr.io/spectrocloud/hello-universe:1.1.2-proxy - hellouniverseapi: ghcr.io/spectrocloud/hello-universe-api:1.0.12 - hellouniversedb: ghcr.io/spectrocloud/hello-universe-db:1.0.2 + hellouniverse: ghcr.io/spectrocloud/hello-universe:1.2.0-proxy + hellouniverseapi: ghcr.io/spectrocloud/hello-universe-api:1.1.0 + hellouniversedb: ghcr.io/spectrocloud/hello-universe-db:1.1.0 apiEnabled: true namespace: ${namespace} port: ${port} From 88b77f2dbafafed3c65db27a74951c89bfaa5348 Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Tue, 24 Sep 2024 10:34:29 -0400 Subject: [PATCH 11/12] fix: bump azure k8s version, update presets manifest --- .../cluster_profiles.tf | 10 +++++----- .../getting-started-deployment-tf/data.tf | 2 +- .../manifests/values-3tier.yaml | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/terraform/getting-started-deployment-tf/cluster_profiles.tf b/terraform/getting-started-deployment-tf/cluster_profiles.tf index cee044a..252cd76 100644 --- a/terraform/getting-started-deployment-tf/cluster_profiles.tf +++ b/terraform/getting-started-deployment-tf/cluster_profiles.tf @@ -53,7 +53,7 @@ resource "spectrocloud_cluster_profile" "aws-profile" { values = templatefile("manifests/values-3tier.yaml", { namespace = var.app_namespace, port = var.app_port, - replicas = var.replicas_number + replicas = var.replicas_number, db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) @@ -113,7 +113,7 @@ resource "spectrocloud_cluster_profile" "aws-profile-kubecost" { values = templatefile("manifests/values-3tier.yaml", { namespace = var.app_namespace, port = var.app_port, - replicas = var.replicas_number + replicas = var.replicas_number, db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) @@ -181,7 +181,7 @@ resource "spectrocloud_cluster_profile" "azure-profile" { values = templatefile("manifests/values-3tier.yaml", { namespace = var.app_namespace, port = var.app_port, - replicas = var.replicas_number + replicas = var.replicas_number, db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) @@ -241,7 +241,7 @@ resource "spectrocloud_cluster_profile" "azure-profile-kubecost" { values = templatefile("manifests/values-3tier.yaml", { namespace = var.app_namespace, port = var.app_port, - replicas = var.replicas_number + replicas = var.replicas_number, db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) @@ -310,7 +310,7 @@ resource "spectrocloud_cluster_profile" "gcp-profile" { values = templatefile("manifests/values-3tier.yaml", { namespace = var.app_namespace, port = var.app_port, - replicas = var.replicas_number + replicas = var.replicas_number, db_password = base64encode(var.db_password), auth_token = base64encode(var.auth_token) }) diff --git a/terraform/getting-started-deployment-tf/data.tf b/terraform/getting-started-deployment-tf/data.tf index 26fd122..5d488fb 100644 --- a/terraform/getting-started-deployment-tf/data.tf +++ b/terraform/getting-started-deployment-tf/data.tf @@ -66,7 +66,7 @@ data "spectrocloud_pack" "azure_cni" { data "spectrocloud_pack" "azure_k8s" { name = "kubernetes" - version = "1.27.5" + version = "1.30.4" registry_uid = data.spectrocloud_registry.public_registry.id } diff --git a/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml b/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml index 9fef889..af5885d 100644 --- a/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml +++ b/terraform/getting-started-deployment-tf/manifests/values-3tier.yaml @@ -18,3 +18,21 @@ manifests: replicas: ${replicas} dbPassword: ${db_password} # Add base64 encoded password authToken: ${auth_token} # Add base64 encoded token + ui: + useTolerations: false + tolerations: + effect: PreferNoSchedule + key: app + value: ui + api: + useTolerations: false + tolerations: + effect: PreferNoSchedule + key: app + value: api + postgres: + useTolerations: false + tolerations: + effect: PreferNoSchedule + key: app + value: postgres From 2f457ca6984ae59658832f6cf0aaae1dab7c429d Mon Sep 17 00:00:00 2001 From: Carolina Delwing Rosa Date: Tue, 24 Sep 2024 16:19:21 -0400 Subject: [PATCH 12/12] fix: bump metallb pack version --- terraform/getting-started-deployment-tf/data.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/getting-started-deployment-tf/data.tf b/terraform/getting-started-deployment-tf/data.tf index 5d488fb..a90193f 100644 --- a/terraform/getting-started-deployment-tf/data.tf +++ b/terraform/getting-started-deployment-tf/data.tf @@ -143,7 +143,7 @@ data "spectrocloud_pack" "vmware_csi" { data "spectrocloud_pack" "vmware_metallb" { name = "lb-metallb-helm" - version = "0.13.11" + version = "0.14.8" registry_uid = data.spectrocloud_registry.public_registry.id }