From a1d403db280f28c106599afbf11a4699f98da463 Mon Sep 17 00:00:00 2001 From: yellow-shine Date: Tue, 7 Jan 2025 15:41:40 +0800 Subject: [PATCH] chore(doc): move docs to guide folder (#50) Signed-off-by: Yellow Shine --- README.md | 2 +- docs/{ => guides}/README.md | 0 docs/{ => guides}/create-a-free-cluster.md | 0 .../create-a-serverless-cluster.md | 0 .../{ => guides}/create-a-standard-cluster.md | 0 docs/{ => guides}/get-start.md | 0 docs/{ => guides}/import-cluster.md | 0 docs/{ => guides}/list-project.md | 0 docs/{ => guides}/list-regions.md | 0 docs/{ => guides}/scale-cluster.md | 0 templates/guides/README.md | 22 +++++ templates/guides/create-a-free-cluster.md | 83 ++++++++++++++++ .../guides/create-a-serverless-cluster.md | 85 +++++++++++++++++ templates/guides/create-a-standard-cluster.md | 87 +++++++++++++++++ templates/guides/get-start.md | 73 ++++++++++++++ templates/guides/import-cluster.md | 72 ++++++++++++++ templates/guides/list-project.md | 34 +++++++ templates/guides/list-regions.md | 95 +++++++++++++++++++ templates/guides/scale-cluster.md | 76 +++++++++++++++ 19 files changed, 628 insertions(+), 1 deletion(-) rename docs/{ => guides}/README.md (100%) rename docs/{ => guides}/create-a-free-cluster.md (100%) rename docs/{ => guides}/create-a-serverless-cluster.md (100%) rename docs/{ => guides}/create-a-standard-cluster.md (100%) rename docs/{ => guides}/get-start.md (100%) rename docs/{ => guides}/import-cluster.md (100%) rename docs/{ => guides}/list-project.md (100%) rename docs/{ => guides}/list-regions.md (100%) rename docs/{ => guides}/scale-cluster.md (100%) create mode 100644 templates/guides/README.md create mode 100644 templates/guides/create-a-free-cluster.md create mode 100644 templates/guides/create-a-serverless-cluster.md create mode 100644 templates/guides/create-a-standard-cluster.md create mode 100644 templates/guides/get-start.md create mode 100644 templates/guides/import-cluster.md create mode 100644 templates/guides/list-project.md create mode 100644 templates/guides/list-regions.md create mode 100644 templates/guides/scale-cluster.md diff --git a/README.md b/README.md index 3a1701f..678c740 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ For general information about Terraform, visit the [official website](https://ww ## User Guide -See [Zilliz Cloud Terraform Integration Overview](./docs/README.md) for more information. +See [Zilliz Cloud Terraform Integration Overview](./docs/guides/README.md) for more information. ## API Documentation diff --git a/docs/README.md b/docs/guides/README.md similarity index 100% rename from docs/README.md rename to docs/guides/README.md diff --git a/docs/create-a-free-cluster.md b/docs/guides/create-a-free-cluster.md similarity index 100% rename from docs/create-a-free-cluster.md rename to docs/guides/create-a-free-cluster.md diff --git a/docs/create-a-serverless-cluster.md b/docs/guides/create-a-serverless-cluster.md similarity index 100% rename from docs/create-a-serverless-cluster.md rename to docs/guides/create-a-serverless-cluster.md diff --git a/docs/create-a-standard-cluster.md b/docs/guides/create-a-standard-cluster.md similarity index 100% rename from docs/create-a-standard-cluster.md rename to docs/guides/create-a-standard-cluster.md diff --git a/docs/get-start.md b/docs/guides/get-start.md similarity index 100% rename from docs/get-start.md rename to docs/guides/get-start.md diff --git a/docs/import-cluster.md b/docs/guides/import-cluster.md similarity index 100% rename from docs/import-cluster.md rename to docs/guides/import-cluster.md diff --git a/docs/list-project.md b/docs/guides/list-project.md similarity index 100% rename from docs/list-project.md rename to docs/guides/list-project.md diff --git a/docs/list-regions.md b/docs/guides/list-regions.md similarity index 100% rename from docs/list-regions.md rename to docs/guides/list-regions.md diff --git a/docs/scale-cluster.md b/docs/guides/scale-cluster.md similarity index 100% rename from docs/scale-cluster.md rename to docs/guides/scale-cluster.md diff --git a/templates/guides/README.md b/templates/guides/README.md new file mode 100644 index 0000000..680e12e --- /dev/null +++ b/templates/guides/README.md @@ -0,0 +1,22 @@ +## Terraform Integration Overview with Zilliz Cloud + +Terraform, an open-source infrastructure as code (IaC) tool by HashiCorp, empowers you to automate the provisioning and management of your cloud resources. + +The Terraform provider for Zilliz Cloud acts as a bridge between Terraform and the Zilliz Cloud platform. This plugin seamlessly integrates Zilliz Cloud resources into your Terraform workflow, allowing you to manage them alongside your existing infrastructure using Terraform configurations. + + +### Getting Started with Terraform and Zilliz Cloud + +This guide provides a comprehensive overview of using Terraform with Zilliz Cloud. Here are the resources to get you started: + +* **Installation**: Learn how to install the Zilliz Cloud Terraform provider and configure it within your Terraform project. Refer to the tutorial: [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) +* **Creating Cluster:** Discover how to define, provision, and manage Zilliz Cloud clusters using Terraform configurations. + * Create Free Plan Clusters for learning, experimenting, and prototype: [Creating a Free Plan Cluster](./create-a-free-cluster.md) + * Create Serverless Plan Clusters designed for serverless applications with variable or infrequent traffic: [Creating a Serverless Plan Cluster](./create-a-serverless-cluster.md) + * Create Standard Plan Clusters with more resources for production workloads: [Creating a Standard Plan Cluster](./create-a-standard-cluster.md) +* **Scaling Clusters**: Learn how to leverage Terraform to upgrade the compute unit size of your Zilliz Cloud clusters to meet changing workload demands: [Upgrading Zilliz Cloud Cluster Compute Unit Size with Terraform](./scale-cluster.md) +* **Importing Existing Clusters**: Utilize Terraform to import existing Zilliz Cloud clusters into your Terraform state, enabling them to be managed alongside other infrastructure using Terraform configurations: [Import Existing Zilliz Cloud Cluster With Terraform](./import-cluster.md) +* **Retrieving Cloud Region**: Retrieve region IDs for Zilliz Cloud clusters across various cloud providers using the `zillizcloud_regions` data source. This tutorial demonstrates how to list regions for AWS, GCP, and Azure: [Acquiring Region IDs for Zilliz Cloud Clusters](./list-regions.md) + +By leveraging Terraform and the Zilliz Cloud Terraform provider, you can streamline your Zilliz Cloud infrastructure management, promoting efficiency and consistency within your cloud deployments. + diff --git a/templates/guides/create-a-free-cluster.md b/templates/guides/create-a-free-cluster.md new file mode 100644 index 0000000..c2013a7 --- /dev/null +++ b/templates/guides/create-a-free-cluster.md @@ -0,0 +1,83 @@ +## Tutorial: Creating a Free Plan Cluster with Terraform + +This tutorial guides you through creating a basic **Free Plan** cluster in Zilliz Cloud using the `zillizcloud_cluster` resource within Terraform. Free Plan cluster is suitable for for learning experimenting, and prototype purposes. + +Check out the [Select the Right Cluster Plan](https://docs.zilliz.com/docs/select-zilliz-cloud-service-plans) for more information on the available plans. + +**You'll learn how to:** + +- Define a Free Plan cluster in Terraform configuration. +- Review and apply changes to provision the cluster in Zilliz Cloud. +- Verify the creation of your Zilliz Cloud cluster. + +### Prerequisites + +Before you begin, make sure you have completed the initial setup steps outlined in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. Additionally, ensure that you have the necessary permissions and access credentials to interact with the Zilliz Cloud API. + +### Creating a Cluster + +Append the following code to your `main.tf` file mentioned in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. + + +```hcl + +data "zillizcloud_project" "default" { + # Fetching the default project information to be used in cluster provisioning +} + +resource "zillizcloud_cluster" "free_plan_cluster" { + # Name for your cluster + cluster_name = "Cluster-01" + # ID of the default project retrieved from data source + project_id = data.zillizcloud_project.default.id +} + +output "cluster_connect_address" { + value = zillizcloud_cluster.free_plan_cluster.connect_address +} +output "cluster_username" { + value = zillizcloud_cluster.free_plan_cluster.username +} +output "cluster_password" { + sensitive = true + value = zillizcloud_cluster.free_plan_cluster.password +} +``` + + +**Explanation:** + +- This configuration defines a `zillizcloud_cluster` resource named `free_plan_cluster`. +- * `cluster_name`: Sets the name of your cluster (here, "Cluster-01"). + * `project_id`: Retrieves the ID of the default project using the `data.zillizcloud_project.default.id` attribute. + +### Planning and Applying Changes + +Once you've defined the cluster resources, it's time to apply the changes to provision the Zilliz Cloud clusters. Navigate to your Terraform project directory and execute the following commands: + +```bash +terraform apply -auto-approve + +Outputs: + +cluster_connect_address = "https://in03-559dde3b4b6de3a.api.gcp-us-west1.zillizcloud.com" +cluster_username = "db_559dde3b4b6de3a" +cluster_password = +``` + +**Note**: The `-auto-approve` flag avoids prompting for confirmation before applying the changes. Use caution, especially in production environments. It's recommended to thoroughly review the plan before applying. + +Terraform will orchestrate the creation of the specified clusters based on your configuration. Once the process is complete, Terraform will display the output values for the cluster's connection address, username, and password. + +### Verifying Provisioned Clusters + +After applying the changes, you can verify the provisioned Zilliz Cloud clusters either through the Zilliz Cloud dashboard. Ensure that the clusters are created with the desired configurations and are functioning as expected. + +## Destroying the Cluster(Optional) +If you want to destroy the cluster, you can run the following command: +``` +$ terraform destroy +``` + +## Next Steps +- Explore creating a **Standard Plan** Cluster: [Creating a Standard Plan Cluster](./create-a-standard-cluster.md) diff --git a/templates/guides/create-a-serverless-cluster.md b/templates/guides/create-a-serverless-cluster.md new file mode 100644 index 0000000..85d226e --- /dev/null +++ b/templates/guides/create-a-serverless-cluster.md @@ -0,0 +1,85 @@ +## Tutorial: Creating a Serverless Plan Cluster with Terraform + +This tutorial guides you through creating a **Serverless Plan** cluster in Zilliz Cloud using the `zillizcloud_cluster` resource within Terraform. Serverless Plan cluster is designed for serverless applications with variable or infrequent traffic. + +Check out the [Select the Right Cluster Plan](https://docs.zilliz.com/docs/select-zilliz-cloud-service-plans) for more information on the available plans. + +**You'll learn how to:** + +- Define a Serverless Plan cluster in Terraform configuration. +- Review and apply changes to provision the cluster in Zilliz Cloud. +- Verify the creation of your Zilliz Cloud cluster. + +### Prerequisites + +Before you begin, make sure you have completed the initial setup steps outlined in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. Additionally, ensure that you have the necessary permissions and access credentials to interact with the Zilliz Cloud API. + +### Creating a Cluster + +Append the following code to your `main.tf` file mentioned in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. + + +```hcl + +data "zillizcloud_project" "default" { + # Fetching the default project information to be used in cluster provisioning +} + +resource "zillizcloud_cluster" "serverless_plan_cluster" { + # Name for your cluster + cluster_name = "Cluster-02" + # The service plan for the cluster + plan = "Serverless" + # ID of the default project retrieved from data source + project_id = data.zillizcloud_project.default.id +} + +output "cluster_connect_address" { + value = zillizcloud_cluster.serverless_plan_cluster.connect_address +} +output "cluster_username" { + value = zillizcloud_cluster.serverless_plan_cluster.username +} +output "cluster_password" { + sensitive = true + value = zillizcloud_cluster.serverless_plan_cluster.password +} +``` + + +**Explanation:** + +- This configuration defines a `zillizcloud_cluster` resource named `serverless_plan_cluster`. +- * `cluster_name`: Sets the name of your cluster (here, "Cluster-02"). + * `project_id`: Retrieves the ID of the default project using the `data.zillizcloud_project.default.id` attribute. + +### Planning and Applying Changes + +Once you've defined the cluster resources, it's time to apply the changes to provision the Zilliz Cloud clusters. Navigate to your Terraform project directory and execute the following commands: + +```bash +terraform apply -auto-approve + +Outputs: + +cluster_connect_address = "https://in05-fb24b4124d4fc98.api.gcp-us-west1.zillizcloud.com" +cluster_username = "db_fb24b4124d4fc98" +cluster_password = +``` + +**Note**: The `-auto-approve` flag avoids prompting for confirmation before applying the changes. Use caution, especially in production environments. It's recommended to thoroughly review the plan before applying. + +Terraform will orchestrate the creation of the specified clusters based on your configuration. Once the process is complete, Terraform will display the output values for the cluster's connection address, username, and password. + +### Verifying Provisioned Clusters + +After applying the changes, you can verify the provisioned Zilliz Cloud clusters either through the Zilliz Cloud dashboard. Ensure that the clusters are created with the desired configurations and are functioning as expected. + +## Destroying the Cluster(Optional) +If you want to destroy the cluster, you can run the following command: +``` +$ terraform destroy +``` + +## Next Steps +- Explore creating a **Standard Plan** Cluster: [Creating a Standard Plan Cluster](./create-a-standard-cluster.md) diff --git a/templates/guides/create-a-standard-cluster.md b/templates/guides/create-a-standard-cluster.md new file mode 100644 index 0000000..bb97665 --- /dev/null +++ b/templates/guides/create-a-standard-cluster.md @@ -0,0 +1,87 @@ +## Tutorial: Creating a Standard Plan Cluster with Terraform + +This tutorial guides you through managing a **Standard Plan** Cluster using the `zillizcloud_cluster` resource within Terraform. Standard Plan Cluster have more resources, compared to Free Plan Cluster and are suitable for production workloads. + +Check out the [Select the Right Cluster Plan](https://docs.zilliz.com/docs/select-zilliz-cloud-service-plans) for more information on the available plans. + +**You'll learn how to:** +- Retrieve project and region IDs for cluster creation. +- Define clusters with various configurations in Terraform. +- Plan and apply changes to provision clusters in Zilliz Cloud. +- Verify the creation of your Zilliz Cloud clusters. + +### Prerequisites + +Before you begin, make sure you have completed the initial setup steps outlined in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. Additionally, ensure that you have the necessary permissions and access credentials to interact with the Zilliz Cloud API. + + +## Retrieving Your Zilliz Cloud Project ID + +There are two ways to find your Zilliz Cloud project ID: + +**1. Zilliz Cloud Console:** + +Refer to the Zilliz Cloud documentation for details on obtaining your project ID through the console: [How Can I Obtain the Project ID?](https://support.zilliz.com/hc/en-us/articles/22048954409755-How-Can-I-Obtain-the-Project-ID) + +**2. Zilliz Cloud Data Source (Optional):** + +For convenience, you can use the `zillizcloud_project` data source to retrieve the ID of the default project associated with your Zilliz Cloud account. + +## Selecting a Zilliz Cloud Region + +This tutorial will use the `aws-us-east-2` region. However, you can choose a different region based on your needs. + +For a full list of available cloud providers and regions, refer to the Zilliz Cloud documentation: [Cloud Providers & Regions](https://docs.zilliz.com/docs/cloud-providers-and-regions) + +### Creating a Cluster + +With the `project ID` and `region ID` at hand, creating Zilliz Cloud clusters is straightforward. Below is an illustrative example defining zillizcloud_cluster resources within Terraform configuration: + +Append the following code to your `main.tf` file mentioned in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. + +```hcl + +data "zillizcloud_project" "default" { + # Fetching the default project information to be used in cluster provisioning +} + +resource "zillizcloud_cluster" "standard_plan_cluster" { + cluster_name = "Cluster-02" # The name of the cluster + region_id = "aws-us-east-2" # The region where the cluster will be deployed + plan = "Standard" # The service plan for the cluster + cu_size = "1" # The size of the compute unit + cu_type = "Performance-optimized" # The type of compute unit, optimized for performance + project_id = data.zillizcloud_project.default.id # Linking to the project ID fetched earlier +} + + +``` +**Explanation of the Configuration:** + +This code creates a Zilliz Cloud cluster named "Cluster-02" in the "aws-us-east-2" region. It serves the "Standard" plan with a single, performance-optimized compute unit, making it suitable for workloads requiring more processing power. + + +### Planning and Applying Changes + +Once you've defined the cluster resources, it's time to apply the changes to provision the Zilliz Cloud clusters. Navigate to your Terraform project directory and execute the following commands: + +```bash +terraform apply -auto-approve +``` + +**Note**: The `-auto-approve` flag avoids prompting for confirmation before applying the changes. Use caution, especially in production environments. It's recommended to thoroughly review the plan before applying. + +Terraform will orchestrate the creation of the specified clusters based on your configuration. Once the process is complete, Terraform will display the output values for the cluster's connection address, username, and password. + +### Verifying Provisioned Clusters + +After applying the changes, you can verify the provisioned Zilliz Cloud clusters either through the Zilliz Cloud dashboard. Ensure that the clusters are created with the desired configurations and are functioning as expected. + +## Destroying the Cluster(Optional) +If you want to destroy the cluster, you can run the following command: +``` +$ terraform destroy +``` + +## Next Steps +- [Upgrading Zilliz Cloud Cluster Compute Unit Size with Terraform](./scale-cluster.md) diff --git a/templates/guides/get-start.md b/templates/guides/get-start.md new file mode 100644 index 0000000..6cc6736 --- /dev/null +++ b/templates/guides/get-start.md @@ -0,0 +1,73 @@ +## Getting Started with Zilliz Cloud Terraform Provider + +This guide walks you through the process of installing and configuring the Zilliz Cloud provider. + +### 1.Prerequisites + +Before you begin, ensure you have the following: + +1. **Terraform Installed**: Download and install Terraform from [here](https://www.terraform.io/downloads.html) by following the provided instructions. + +2. **Zilliz Cloud Account**: Access to Zilliz Cloud and your API Key are essential. Refer to the [documentation](https://docs.zilliz.com/docs/manage-api-keys) to obtain your API key. + +## 2. Download Zilliz Cloud Terraform Provider + +Start by configuring the Zilliz Cloud provider within your Terraform configuration file (`main.tf`). Follow these steps: + +```hcl +terraform { + required_providers { + zillizcloud = { + source = "zilliztech/zillizcloud" + } + } +} +``` + +## 3. Initialize Terraform Configuration + +Initialize the Terraform configuration by running: + +```bash +terraform init +``` + +Terraform will download the `zillizcloud` provider and install it in a hidden subdirectory of your current working directory, named `.terraform`. + +### 4. Authenticate Zilliz Cloud Terraform Provider + +Your Zilliz Cloud API Key is required to use the Terraform Provider. There are two ways to configure this. + +#### Option 1: Specify API Key in Provider Block + +Append the following code to your `main.tf` file: + +```hcl +provider "zillizcloud" { + api_key = "" +} +``` + +Replace `` with your Zilliz Cloud API Key. + +#### Option 2: Use Environment Variable + +Set the API key as an environment variable: + +```bash +export ZILLIZCLOUD_API_KEY="" +``` + +Then the provider declaration in your `main.tf` file is simply: + +```hcl +provider "zillizcloud" { +} +``` + +By following these steps, you should have the Zilliz Cloud Terraform provider configured and ready to move on to the next steps. + +## Next Steps +- Explore creating a **Free Plan** Cluster: [Creating a Free Plan Cluster](./create-a-free-cluster.md) +- Explore creating a **Serverless Plan** Cluster: [Creating a Serverless Plan Cluster](./create-a-serverless-cluster.md) +- Explore creating a **Standard Plan** Cluster: [Creating a Standard Plan Cluster](./create-a-standard-cluster.md) diff --git a/templates/guides/import-cluster.md b/templates/guides/import-cluster.md new file mode 100644 index 0000000..2dd699c --- /dev/null +++ b/templates/guides/import-cluster.md @@ -0,0 +1,72 @@ +## Importing Existing Zilliz Cloud Clusters with Terraform + +This tutorial guides you through importing existing Zilliz Cloud clusters into your Terraform state file. Importing allows you to manage these clusters using Terraform configurations, enabling infrastructure as code practices. + +### Prerequisites + +Before you begin, make sure you have completed the initial setup steps outlined in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. Additionally, ensure that you have the necessary permissions and access credentials to interact with the Zilliz Cloud API. + +### Understanding Cluster Importing + +Importing allows you to bring existing Zilliz Cloud clusters under Terraform's management. This means Terraform will track the cluster's configuration and resources within its state file. By managing your clusters through Terraform, you can leverage infrastructure as code (IaC) practices for consistent and automated cluster provisioning and management. + + +### Steps to Import a Zilliz Cloud Cluster + +Here's a step-by-step guide on importing an existing Zilliz Cloud cluster into your Terraform state: + +1. **Identify Cluster Details**: Gather the following information about the Zilliz Cloud cluster you intend to import: + * **Cluster ID**: A unique identifier assigned to the cluster within Zilliz Cloud. You can find this ID in the Zilliz Cloud dashboard (e.g., `"in01-1da9c8686b882d0"`). + * **Region ID**: The region where the cluster is deployed (e.g., `aws-us-east-2`). + +2. **Import zillizcloud_cluster resource**: In order to import a existing cluster, it's recommended to create a basic `zillizcloud_cluster` resource block in your Terraform configuration file. This block will serve as a placeholder for the imported cluster and can be further customized later. Here's an example: + + ```hcl + resource "zillizcloud_cluster" "imported_cluster" { + # ... attributes will be populated during import process ... + } + ``` + +3. **Import the Cluster**: Use the `terraform import` command to instruct Terraform to import the existing cluster. The general syntax is: + + ```bash + terraform import RESOURCE_TYPE.RESOURCE_NAME CLUSTER_ID,REGION_ID + ``` + + Replace the placeholders with the following details: + + * `RESOURCE_TYPE`: Set this to `"zillizcloud_cluster"`. + * `RESOURCE_NAME`: This is the name you'll assign to the imported cluster resource in Terraform (e.g., `"imported_cluster"`). + * `RESOURCE_ID`: Provide the cluster ID obtained in step 1 (e.g., `"in01-1da9c8686b882d0"`). + * `REGION_ID`: The region where the cluster is deployed(e.g., `"aws-us-east-2"`). + + + Here's an example command assuming you named the imported cluster resource `"standard_plan_cluster"`: + + ```bash + terraform import zillizcloud_cluster.imported_cluster in01-1da9c8686b882d0,aws-us-east-2 + ``` + +4. **Confirm Import**: Terraform will attempt to retrieve information about the cluster from the Zilliz Cloud API and populate the corresponding resource block in your Terraform configuration. If successful, you'll see confirmation messages indicating a successful import. + +5. **Verify Import**: After a successful import, you can use the `terraform state show` command to view the details of the imported cluster within your Terraform state: + + ```bash + terraform state show zillizcloud_cluster.imported_cluster + + resource "zillizcloud_cluster" "imported_cluster" { + cluster_name = "Cluster-02" + cluster_type = "Performance-optimized" + connect_address = "https://in01-1da9c8686b882d0.aws-us-east-2.vectordb.zillizcloud.com:19539" + create_time = "2024-05-15T07:36:21Z" + cu_size = 1 + description = "pre create instance" + id = "in01-1da9c8686b882d0" + project_id = "proj-4487580fcfe2c8a4391686" + region_id = "aws-us-east-2" + status = "RUNNING" + } + ``` + + This command will display the attributes and current configuration of the imported cluster. + diff --git a/templates/guides/list-project.md b/templates/guides/list-project.md new file mode 100644 index 0000000..0f0e62a --- /dev/null +++ b/templates/guides/list-project.md @@ -0,0 +1,34 @@ + +## Retrieving Project IDs in Your Zilliz Cloud Account + +Every Zilliz Cloud cluster is associated with a project. To create a cluster, it's imperative to obtain the corresponding project ID. + +To access information regarding available projects, utilize the zillizcloud_projects data source as demonstrated below: + +```hcl +data "zillizcloud_project" "default" {} + +output "projects" { + value = data.zillizcloud_project.default +} +``` + +```shell +$ terraform apply --auto-approve + +data.zillizcloud_project.default: Reading... +data.zillizcloud_project.default: Read complete after 1s [id=proj-4487580fcfe2c8a4391686] + +Apply complete! Resources: 0 added, 0 changed, 0 destroyed. + +Outputs: + +projects = { + "created_at" = 1714892175000 + "id" = "proj-4487580fcfe2cxxxxx" + "instance_count" = 0 + "name" = "Default Project" +} +``` + +The project ID **"proj-4487580fcfe2cxxxxx"** is displayed in the output section. You can use your ID to create Zilliz Cloud clusters within the specified project, or refer to the project ID via `data.zillizcloud_project.default.id` in your Terraform configuration file. diff --git a/templates/guides/list-regions.md b/templates/guides/list-regions.md new file mode 100644 index 0000000..ecddce4 --- /dev/null +++ b/templates/guides/list-regions.md @@ -0,0 +1,95 @@ +## Acquiring Region IDs for Zilliz Cloud Clusters + +To provision Zilliz Cloud clusters, you need to specify the region where the cluster will be deployed. Zilliz Cloud supports multiple regions across various cloud providers, such as AWS, GCP, and Azure. + +Refer to the Zilliz Cloud documentation, [Cloud Providers & Regions](https://docs.zilliz.com/docs/cloud-providers-and-regions), for a full list of available cloud providers and regions. + +This tutorial demonstrates how to retrieve region IDs for each cloud provider using the `zillizcloud_regions` data source. While this information is also available in the documentation, the data source provides a Terraform-friendly way to integrate it into your infrastructure code. + +### 1.Prerequisites + +Before you begin, ensure you have the following: + +1. **Terraform Installed**: Download and install Terraform from [here](https://www.terraform.io/downloads.html) by following the provided instructions. + +2. **Zilliz Cloud Account**: Access to Zilliz Cloud and your API Key are essential. Refer to the [documentation](https://docs.zilliz.com/docs/manage-api-keys) to obtain your API key. + + + +## Listing Zilliz Cloud Regions + +This code snippet demonstrates how to retrieve region information for specific cloud providers: + +```terraform +data "zillizcloud_regions" "aws_region" { + cloud_id = "aws" +} + +data "zillizcloud_regions" "gcp_region" { + cloud_id = "gcp" +} + +data "zillizcloud_regions" "azure_region" { + cloud_id = "azure" +} + +output "aws_output" { + value = data.zillizcloud_regions.aws_region.items +} + +output "gcp_output" { + value = data.zillizcloud_regions.gcp_region.items +} + +output "azure_output" { + value = data.zillizcloud_regions.azure_region.items +} +``` + +**Explanation:** + +* We define three `zillizcloud_regions` data sources: `aws_region`, `gcp_region`, and `azure_region`. +* Each data source retrieves regions for a specific cloud provider using the `cloud_id` argument. +* The `output` blocks define outputs named `aws_output`, `gcp_output`, and `azure_output`. +* These outputs reference the `.items` attribute of the corresponding data source, which contains a list of region objects. + + +### Executing the Terraform Script + +Run the following command to execute the Terraform script and retrieve region information: + +``` +terraform apply --auto-approve +``` + +This command applies the Terraform configuration and displays the retrieved region details. The output will be similar to this: + +``` +... +data.zillizcloud_regions.gcp_region: Reading... +data.zillizcloud_regions.aws_region: Reading... +data.zillizcloud_regions.azure_region: Reading... + +Outputs: + +aws_output = tolist([ + ... + { + "api_base_url" = "https://api.aws-us-west-2.zillizcloud.com" + "cloud_id" = "aws" + "region_id" = "aws-us-west-2" + }, + ... +]) +azure_output = tolist([ + ... +]) +gcp_output = tolist([ + ... +]) +``` + +The script retrieves region details for each cloud provider specified in the `cloud_id` arguments. In this example, the output showcases the `aws-us-east-2` region for the AWS cloud provider. + +This retrieved region ID (e.g., `aws-us-east-2`) can be used to create Zilliz Cloud clusters within the specified region in subsequent Terraform configurations. + diff --git a/templates/guides/scale-cluster.md b/templates/guides/scale-cluster.md new file mode 100644 index 0000000..c86cb67 --- /dev/null +++ b/templates/guides/scale-cluster.md @@ -0,0 +1,76 @@ +# Upgrading Zilliz Cloud Cluster Compute Unit Size with Terraform + +This tutorial guides you through upgrading the compute unit (CU) size of an existing Zilliz Cloud cluster using Terraform. Scaling your cluster's CU size allows you to adjust its processing power to meet the demands of your workloads. + +### Prerequisites + +Before you begin, make sure you have completed the initial setup steps outlined in the [Getting Started with Zilliz Cloud Terraform Provider](./get-start.md) guide. Additionally, ensure that you have the necessary permissions and access credentials to interact with the Zilliz Cloud API. + +### Understanding Compute Units (CUs) + +Zilliz Cloud clusters are allocated resources in the form of compute units (CUs). Each CU represents a specific amount of processing power, memory, and storage. Upgrading the CU size of your cluster increases the overall resources available to handle more demanding workloads. + +**Important Note:** The available CU sizes and pricing may vary depending on your Zilliz Cloud account, region, and chosen service plan. Refer to the Zilliz Cloud documentation for detailed information on CU sizes and pricing for your specific configuration. + + +### Upgrading the CU Size with Terraform + +Here's how to leverage Terraform to upgrade the CU size for your Zilliz Cloud cluster: + +1. **Modify Terraform Configuration**: Locate the Terraform configuration block defining your Zilliz Cloud cluster resource (typically named `zillizcloud_cluster`). + +2. **Identify `cu_size` Attribute**: Within the cluster definition, identify the `cu_size` attribute. This attribute specifies the current number of CUs allocated to your cluster. + +3. **Specify New CU Size**: Update the value of the `cu_size` attribute to reflect the desired increase in resources. Refer to the Zilliz Cloud documentation for valid CU size options within your region and service plan. + +**Example:** + +Assuming your current cluster configuration is similar to the following: + +```hcl +resource "zillizcloud_cluster" "standard_plan_cluster" { + cluster_name = "Cluster-02" + # ... other fields ... + cu_size = 1 # Current CU size + # ... other fields ... +} +``` + +To upgrade the cluster's CU size to 2, modify the configuration as follows: + +```hcl +resource "zillizcloud_cluster" "standard_plan_cluster" { + cluster_name = "Cluster-02" + # ... other fields ... + cu_size = 2 # Upgraded CU size + # ... other fields ... +} +``` + +4. **Save Changes**: Save the modifications made to your Terraform configuration file. + + +### Applying the Upgrade + + +**Apply Changes**: If the plan looks good, proceed with applying the changes to upgrade the CU size in Zilliz Cloud: + + ```bash + terraform apply -auto-approve + ``` + +**Note**: The `-auto-approve` flag avoids prompting for confirmation before applying the changes. Use caution, especially in production environments. It's recommended to thoroughly review the plan before applying. + +Terraform will now initiate the upgrade process, scaling your Zilliz Cloud cluster to the specified CU size. + + +## Destroying the Cluster(Optional) +If you want to destroy the cluster, you can run the following command: +``` +$ terraform destroy +``` + +### Verifying the Upgrade + +Once Terraform finishes applying the changes, you can verify that the CU size of your cluster has been upgraded successfully via the Zilliz Cloud dashboard. Log in to your Zilliz Cloud account and navigate to the Clusters section in the dashboard. Select the upgraded cluster and view its details. The CU size should now reflect the value you specified in your Terraform configuration. +