Skip to content

Commit

Permalink
chore(doc):update (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: Liang Huang <[email protected]>
  • Loading branch information
yellow-shine authored May 16, 2024
1 parent 1ee68fb commit d28819d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 27 deletions.
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ The Terraform provider for Zilliz Cloud acts as a bridge between Terraform and t
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)
* **Cluster Management:** Discover how to define, provision, and manage Zilliz Cloud clusters using Terraform configurations.
* **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 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.

1 change: 1 addition & 0 deletions docs/import-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This tutorial guides you through importing existing Zilliz Cloud clusters into y
### 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.
Expand Down
74 changes: 48 additions & 26 deletions docs/list-regions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
## Acquiring Region IDs for Zilliz Cloud Clusters

## Acquiring Region IDs for Zilliz Cloud Cluster
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.

To provision Zilliz Cloud clusters, you'll must specify the region where the cluster will be deployed. Zilliz Cloud supports multiple regions across various cloud providers, such as AWS, GCP, and Azure. You can retrieve the region IDs for each cloud provider using the zillizcloud_regions data source.
### 1.Prerequisites

```terraform
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"
}
Expand All @@ -19,55 +33,63 @@ data "zillizcloud_regions" "azure_region" {
cloud_id = "azure"
}
output "aws_ouput" {
output "aws_output" {
value = data.zillizcloud_regions.aws_region.items
}
output "gcp_ouput" {
output "gcp_output" {
value = data.zillizcloud_regions.gcp_region.items
}
output "azure_ouput" {
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
terraform apply --auto-approve
```

This command applies the Terraform configuration and displays the retrieved region details. The output will be similar to this:

learn-terraform terraform apply -auto-approve
```
...
data.zillizcloud_regions.gcp_region: Reading...
data.zillizcloud_regions.aws_region: Reading...
data.zillizcloud_regions.azure_region: Reading...
data.zillizcloud_project.default: Reading...
data.zillizcloud_regions.aws_region: Read complete after 0s
data.zillizcloud_regions.gcp_region: Read complete after 0s
data.zillizcloud_regions.azure_region: Read complete after 0s
data.zillizcloud_project.default: Read complete after 0s [id=proj-4487580fcfe2c8a4391686]
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
aws_ouput = tolist([
...
aws_output = tolist([
...
{
"api_base_url" = "https://api.aws-us-west-2.zillizcloud.com"
"cloud_id" = "aws"
"region_id" = "aws-us-west-2"
},
...
...
])
azure_ouput = tolist([
...
azure_output = tolist([
...
])
gcp_ouput = tolist([
...
gcp_output = tolist([
...
])
```

Upon execution, this Terraform script retrieves region details for each cloud provider, facilitating subsequent cluster provisioning steps. In this session, we would use **aws-us-east-2** in the following example.
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.

0 comments on commit d28819d

Please sign in to comment.