Skip to content

Commit 2c48e86

Browse files
Linus-SpectroCloudlinusbourquecaroldelwing
authored
feat: new TF module for Cluster Profile Variable Tutorial (#48)
* new TF module for Cluster Profilve Variable Tutorial * Update terraform/cluster-profile-variables-tf/README.md Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/README.md Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/README.md Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/README.md Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/cluster_profiles.tf Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/cluster_profiles.tf Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/tests/pack-and-profile.tftest.hcl Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/terraform.tfvars Co-authored-by: caroldelwing <[email protected]> * Update terraform/cluster-profile-variables-tf/tests/aws.tftest.hcl Co-authored-by: caroldelwing <[email protected]> * doc-1825: applied Carolina's suggestions * doc-1825: applied Carolina's suggestions * doc-1825: replaced replicaCount with wordpress_replica for consistency * doc-1825: Terraform changes for Cluster Profile Variables tutorial * doc-1825-tf-code: minor manifest file changes * doc-1825: updates from Adelina's comments June 11 * doc-1825: added adjusted TF workflow * Apply suggestions from code review Co-authored-by: caroldelwing <[email protected]> * doc-1825: hopefully final commit as per Carolina suggestions --------- Co-authored-by: Linus C Bourque <[email protected]> Co-authored-by: caroldelwing <[email protected]>
1 parent 2354ded commit 2c48e86

20 files changed

+3957
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ The following tutorial code is available:
2424

2525
- [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)
2626

27+
- [cluster-profile-variables-tf](./terraform/cluster-profile-variables-tf/README.md) - Learn how to deploy a cluster using cluster profile variables to AWS, Azure, and GCP. [Link](https://docs.spectrocloud.com/getting-started/terraform)
28+
29+
2730
## Docker
2831

2932
All the tutorials are available in a Docker image that you can use to get started with the tutorials.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Cluster Profile Variables Tutorial
2+
3+
This folder contains the demo code for the **Cluster Profile Variables** tutorial.
4+
5+
The Terraform code has three main toggle variables that you can use to deploy to one of the following cloud providers.
6+
7+
| Variable | Provider | Description | Default |
8+
| --------------- | -------------- | --------------------------------------------- | ------- |
9+
| `deploy-aws` | AWS | Enable to deploy a cluster to AWS. | `false` |
10+
| `deploy-azure` | Azure | Enable to deploy a cluster to Azure. | `false` |
11+
| `deploy-gcp` | GCP | Enable to deploy a cluster to GCP. | `false` |
12+
13+
14+
> You can enable as many providers as you want, just make sure to specify all required values for each provider.
15+
16+
To get started, open the **terraform.tfvars** file. Set the provider variable as specified in the table to `true` and provide values to your cloud provider variables, replacing all instances of the string `REPLACE ME`.
17+
18+
<!-- BEGIN_TF_DOCS -->
19+
## Requirements
20+
21+
| Name | Version |
22+
|------|---------|
23+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9 |
24+
| <a name="requirement_local"></a> [local](#requirement\_local) | 2.4.1 |
25+
| <a name="requirement_spectrocloud"></a> [spectrocloud](#requirement\_spectrocloud) | >= 0.23.6 |
26+
| <a name="requirement_tls"></a> [tls](#requirement\_tls) | 4.0.4 |
27+
28+
## Providers
29+
30+
| Name | Version |
31+
|------|---------|
32+
| <a name="provider_spectrocloud"></a> [spectrocloud](#provider\_spectrocloud) | 0.23.6 |
33+
| <a name="provider_tls"></a> [tls](#provider\_tls) | 4.0.4 |
34+
35+
## Modules
36+
37+
No modules.
38+
39+
## Resources
40+
41+
| Name | Type |
42+
|------|------|
43+
| [spectrocloud_cluster_aws.aws-novar](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_aws) | resource |
44+
| [spectrocloud_cluster_azure.azure-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_azure) | resource |
45+
| [spectrocloud_cluster_gcp.gcp-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_gcp) | resource |
46+
| [spectrocloud_cluster_profile.aws-profile-novar](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource |
47+
| [spectrocloud_cluster_profile.aws-profile-var](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource |
48+
| [spectrocloud_cluster_profile.azure-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource |
49+
| [spectrocloud_cluster_profile.gcp-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile) | resource |
50+
| [tls_private_key.tutorial_ssh_key_azure](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource |
51+
| [spectrocloud_cloudaccount_aws.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_aws) | data source |
52+
| [spectrocloud_cloudaccount_azure.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_azure) | data source |
53+
| [spectrocloud_cloudaccount_gcp.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cloudaccount_gcp) | data source |
54+
| [spectrocloud_pack.aws_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
55+
| [spectrocloud_pack.aws_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
56+
| [spectrocloud_pack.aws_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
57+
| [spectrocloud_pack.aws_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
58+
| [spectrocloud_pack.azure_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
59+
| [spectrocloud_pack.azure_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
60+
| [spectrocloud_pack.azure_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
61+
| [spectrocloud_pack.azure_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
62+
| [spectrocloud_pack.gcp_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
63+
| [spectrocloud_pack.gcp_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
64+
| [spectrocloud_pack.gcp_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
65+
| [spectrocloud_pack.gcp_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
66+
| [spectrocloud_pack.hellouniverse](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/pack) | data source |
67+
| [spectrocloud_registry.community_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source |
68+
| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/registry) | data source |
69+
70+
## Inputs
71+
72+
| Name | Description | Type | Default | Required |
73+
|------|-------------|------|---------|:--------:|
74+
| <a name="input_app_port"></a> [app\_port](#input\_app\_port) | The cluster port number on which the service will listen for incoming traffic. | `number` | n/a | yes |
75+
| <a name="input_auth_token"></a> [auth\_token](#input\_auth\_token) | The base64 encoded auth token for the API connection. | `string` | n/a | yes |
76+
| <a name="input_aws-cloud-account-name"></a> [aws-cloud-account-name](#input\_aws-cloud-account-name) | The name of your AWS account as assigned in Palette. | `string` | n/a | yes |
77+
| <a name="input_aws-key-pair-name"></a> [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 |
78+
| <a name="input_aws-region"></a> [aws-region](#input\_aws-region) | AWS region | `string` | `"us-east-2"` | no |
79+
| <a name="input_aws_control_plane_nodes"></a> [aws\_control\_plane\_nodes](#input\_aws\_control\_plane\_nodes) | AWS control plane nodes configuration. | <pre>object({<br/> count = string<br/> control_plane = bool<br/> instance_type = string<br/> disk_size_gb = string<br/> availability_zones = list(string)<br/> })</pre> | <pre>{<br/> "availability_zones": [<br/> "us-east-2a"<br/> ],<br/> "control_plane": true,<br/> "count": "1",<br/> "disk_size_gb": "60",<br/> "instance_type": "m4.2xlarge"<br/>}</pre> | no |
80+
| <a name="input_aws_worker_nodes"></a> [aws\_worker\_nodes](#input\_aws\_worker\_nodes) | AWS worker nodes configuration. | <pre>object({<br/> count = string<br/> control_plane = bool<br/> instance_type = string<br/> disk_size_gb = string<br/> availability_zones = list(string)<br/> })</pre> | <pre>{<br/> "availability_zones": [<br/> "us-east-2a"<br/> ],<br/> "control_plane": false,<br/> "count": "1",<br/> "disk_size_gb": "60",<br/> "instance_type": "m4.2xlarge"<br/>}</pre> | no |
81+
| <a name="input_azure-cloud-account-name"></a> [azure-cloud-account-name](#input\_azure-cloud-account-name) | The name of your Azure account as assigned in Palette. | `string` | `""` | no |
82+
| <a name="input_azure-region"></a> [azure-region](#input\_azure-region) | Azure region. | `string` | `"eastus"` | no |
83+
| <a name="input_azure-use-azs"></a> [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 |
84+
| <a name="input_azure_control_plane_nodes"></a> [azure\_control\_plane\_nodes](#input\_azure\_control\_plane\_nodes) | Azure control plane nodes configuration. | <pre>object({<br/> count = string<br/> control_plane = bool<br/> instance_type = string<br/> disk_size_gb = string<br/> azs = list(string)<br/> is_system_node_pool = bool<br/> })</pre> | <pre>{<br/> "azs": [<br/> "1"<br/> ],<br/> "control_plane": true,<br/> "count": "1",<br/> "disk_size_gb": "60",<br/> "instance_type": "Standard_A8_v2",<br/> "is_system_node_pool": false<br/>}</pre> | no |
85+
| <a name="input_azure_resource_group"></a> [azure\_resource\_group](#input\_azure\_resource\_group) | Azure resource group. | `string` | `""` | no |
86+
| <a name="input_azure_subscription_id"></a> [azure\_subscription\_id](#input\_azure\_subscription\_id) | Azure subscription ID. | `string` | `""` | no |
87+
| <a name="input_azure_worker_nodes"></a> [azure\_worker\_nodes](#input\_azure\_worker\_nodes) | Azure worker nodes configuration. | <pre>object({<br/> count = string<br/> control_plane = bool<br/> instance_type = string<br/> disk_size_gb = string<br/> azs = list(string)<br/> is_system_node_pool = bool<br/> })</pre> | <pre>{<br/> "azs": [<br/> "1"<br/> ],<br/> "control_plane": false,<br/> "count": "1",<br/> "disk_size_gb": "60",<br/> "instance_type": "Standard_A8_v2",<br/> "is_system_node_pool": false<br/>}</pre> | no |
88+
| <a name="input_db_password"></a> [db\_password](#input\_db\_password) | The base64 encoded database password to connect to the API database. | `string` | n/a | yes |
89+
| <a name="input_deploy-aws-novar"></a> [deploy-aws-novar](#input\_deploy-aws-novar) | A flag for enabling a deployment on AWS. | `bool` | n/a | yes |
90+
| <a name="input_deploy-aws-var"></a> [deploy-aws-var](#input\_deploy-aws-var) | A flag for enabling a deployment on AWS using cluster profile variables. | `bool` | n/a | yes |
91+
| <a name="input_deploy-azure"></a> [deploy-azure](#input\_deploy-azure) | A flag for enabling a deployment on Azure. | `bool` | n/a | yes |
92+
| <a name="input_deploy-azure-var"></a> [deploy-azure-var](#input\_deploy-azure-var) | A flag for enabling a deployment on Azure using cluster profile variables. | `bool` | n/a | yes |
93+
| <a name="input_deploy-gcp"></a> [deploy-gcp](#input\_deploy-gcp) | A flag for enabling a deployment on GCP. | `bool` | n/a | yes |
94+
| <a name="input_deploy-gcp-var"></a> [deploy-gcp-var](#input\_deploy-gcp-var) | A flag for enabling a deployment on GCP using cluster profile variables. | `bool` | n/a | yes |
95+
| <a name="input_gcp-cloud-account-name"></a> [gcp-cloud-account-name](#input\_gcp-cloud-account-name) | The name of your GCP account as assigned in Palette. | `string` | `""` | no |
96+
| <a name="input_gcp-region"></a> [gcp-region](#input\_gcp-region) | GCP region | `string` | `"us-central1"` | no |
97+
| <a name="input_gcp_control_plane_nodes"></a> [gcp\_control\_plane\_nodes](#input\_gcp\_control\_plane\_nodes) | GCP control plane nodes configuration. | <pre>object({<br/> count = string<br/> control_plane = bool<br/> instance_type = string<br/> disk_size_gb = string<br/> availability_zones = list(string)<br/> })</pre> | <pre>{<br/> "availability_zones": [<br/> "us-central1-a"<br/> ],<br/> "control_plane": true,<br/> "count": "1",<br/> "disk_size_gb": "60",<br/> "instance_type": "n1-standard-4"<br/>}</pre> | no |
98+
| <a name="input_gcp_project_name"></a> [gcp\_project\_name](#input\_gcp\_project\_name) | The name of your GCP project. | `string` | `""` | no |
99+
| <a name="input_gcp_worker_nodes"></a> [gcp\_worker\_nodes](#input\_gcp\_worker\_nodes) | GCP worker nodes configuration. | <pre>object({<br/> count = string<br/> control_plane = bool<br/> instance_type = string<br/> disk_size_gb = string<br/> availability_zones = list(string)<br/> })</pre> | <pre>{<br/> "availability_zones": [<br/> "us-central1-a"<br/> ],<br/> "control_plane": false,<br/> "count": "1",<br/> "disk_size_gb": "60",<br/> "instance_type": "n1-standard-4"<br/>}</pre> | no |
100+
| <a name="input_palette-project"></a> [palette-project](#input\_palette-project) | The name of your project in Palette. | `string` | n/a | yes |
101+
| <a name="input_profile_namespace"></a> [profile\_namespace](#input\_profile\_namespace) | The namespace in which the application will be deployed. | `string` | n/a | yes |
102+
| <a name="input_replicas_number"></a> [replicas\_number](#input\_replicas\_number) | The number of pods to be created. | `number` | n/a | yes |
103+
| <a name="input_tags"></a> [tags](#input\_tags) | The default tags to apply to Palette resources. | `list(string)` | <pre>[<br/> "spectro-cloud-education",<br/> "app:hello-universe",<br/> "spectrocloud:tutorials",<br/> "terraform_managed:true",<br/> "tutorial:getting-started-terraform"<br/>]</pre> | no |
104+
105+
## Outputs
106+
107+
| Name | Description |
108+
|------|-------------|
109+
| <a name="output_Advisory"></a> [Advisory](#output\_Advisory) | n/a |
110+
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)