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