Skip to content

Commit

Permalink
feat: refine documentation (#28)
Browse files Browse the repository at this point in the history
* feat: support managing cluster users

* udpate

* fix lint

* do not overwrite password

* fix lint

* fix

* refactor: make fake state interface clear

* fix wrong cluster name when getting cluster id

* feat: support managing private links

* acc test

* refine acceptance test

* private link docs

* fix]

* fix doc

* feat: refine documentation

* apply suggestions; add more infos

* add description
  • Loading branch information
cloudcarver authored Mar 27, 2024
1 parent 7a0f746 commit defd2a7
Show file tree
Hide file tree
Showing 11 changed files with 610 additions and 9 deletions.
169 changes: 169 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,181 @@
page_title: "risingwavecloud Provider"
subcategory: ""
description: |-
The Terraform plugin for RisingWave Cloud https://cloud.risingwave.com/ allows you to manage your resources
on the RisingWave Cloud platform with Terraform.
This project is under heavy development. Please join our
Slack https://join.slack.com/t/risingwave-community/shared_invite/zt-1jei7dk79-fguGadPI2KnhtWnnxBVGoA to get the latest information.
Quick Start
```hcl
Install Terraform provider for RisingWave Cloud
terraform {
required_providers {
risingwavecloud = {
source = "risingwavelabs/risingwavecloud"
version =
}
}
}
Configure the RisingWave Cloud provider
provider "risingwavecloud" {
apikey =
apisecret =
}
Create a RisingWave Cluster
resource "risingwavecloudcluster" "mycluster" {
name = "mycluster"
version = "v1.7.1"
region = "us-east-1"
spec = {
risingwaveconfig = ""
compute = {
defaultnodegroup = {
cpu = "0.5"
memory = "2 GB"
}
}
compactor = {
defaultnodegroup = {
cpu = "1"
memory = "4 GB"
}
}
meta = {
defaultnodegroup = {
cpu = "0.5"
memory = "2 GB"
}
etcdmetastore = {
defaultnodegroup = {
cpu = "0.5"
memory = "2 GB"
}
}
}
frontend = {
defaultnodegroup = {
cpu = "0.5"
memory = "2 GB"
}
}
}
}```
Authentication
The API key and API secret are created at the RisingWave Cloud portal https://cloud.risingwave.com/.
Note that you can also use environment variables to set the API key and API secret:
hcl
RWC_API_KEY=myapikeyvalue
RWC_API_SECRET=myapisecretvalue
This allows you to manage your credentials in a more secure way.
Import Resources
You can import existing resources into Terraform using the terraform import command.
To import a resource, you need to know the resource ID to let the provider know which resource to fetch from
the RisingWave Cloud platform. Read the documentation of each resource to know how to get its ID.
For more details about this command, check the Terraform documentation https://developer.hashicorp.com/terraform/cli/import.
Feature Requests
Please join our
Slack https://join.slack.com/t/risingwave-community/shared_invite/zt-1jei7dk79-fguGadPI2KnhtWnnxBVGoA to request new features.
Reporting Issues
Please report any issues at the GitHub repository https://github.com/risingwavelabs/terraform-provider-risingwavecloud.
---

# risingwavecloud Provider

The Terraform plugin for [RisingWave Cloud](https://cloud.risingwave.com/) allows you to manage your resources
on the RisingWave Cloud platform with Terraform.

**This project is under heavy development. Please join our
[Slack](https://join.slack.com/t/risingwave-community/shared_invite/zt-1jei7dk79-fguGadPI2KnhtWnnxBVGoA) to get the latest information.**

## Quick Start

```hcl
# Install Terraform provider for RisingWave Cloud
terraform {
required_providers {
risingwavecloud = {
source = "risingwavelabs/risingwavecloud"
version = <provider version>
}
}
}
# Configure the RisingWave Cloud provider
provider "risingwavecloud" {
api_key = <API Key>
api_secret = <API Secret>
}
# Create a RisingWave Cluster
resource "risingwavecloud_cluster" "my_cluster" {
name = "my_cluster"
version = "v1.7.1"
region = "us-east-1"
spec = {
risingwave_config = ""
compute = {
default_node_group = {
cpu = "0.5"
memory = "2 GB"
}
}
compactor = {
default_node_group = {
cpu = "1"
memory = "4 GB"
}
}
meta = {
default_node_group = {
cpu = "0.5"
memory = "2 GB"
}
etcd_meta_store = {
default_node_group = {
cpu = "0.5"
memory = "2 GB"
}
}
}
frontend = {
default_node_group = {
cpu = "0.5"
memory = "2 GB"
}
}
}
}
```


## Authentication
The API key and API secret are created at the [RisingWave Cloud portal](https://cloud.risingwave.com/).

Note that you can also use environment variables to set the API key and API secret:
```hcl
RWC_API_KEY=myapikeyvalue
RWC_API_SECRET=myapisecretvalue
```
This allows you to manage your credentials in a more secure way.


## Import Resources
You can import existing resources into Terraform using the `terraform import` command.

To import a resource, you need to know the resource ID to let the provider know which resource to fetch from
the RisingWave Cloud platform. Read the documentation of each resource to know how to get its ID.

For more details about this command, check the [Terraform documentation](https://developer.hashicorp.com/terraform/cli/import).


## Feature Requests
Please join our
[Slack](https://join.slack.com/t/risingwave-community/shared_invite/zt-1jei7dk79-fguGadPI2KnhtWnnxBVGoA) to request new features.


## Reporting Issues
Please report any issues at the [GitHub repository](https://github.com/risingwavelabs/terraform-provider-risingwavecloud).

## Example Usage

Expand Down
117 changes: 115 additions & 2 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,125 @@
page_title: "risingwavecloud_cluster Resource - terraform-provider-risingwavecloud"
subcategory: ""
description: |-
A RisingWave Cluster
A managed RisingWave Cluster on the RisingWave Cloud platform.
Import a RisingWave Cluster
To import a RisingWave cluster, follow the steps below:
Get the UUID of the cluster from the RisingWave Cloud platform.Write a resource definition to import the cluster. For example:
```hcl
resource "risingwavecloudcluster" "mycluster" {
region = "us-east-1"
name = "mycluster"
version = "v1.8.0"
spec = {
compute = {
defaultnodegroup = {
cpu = "2"
memory = "8 GB"
replica = 1
}
}
compactor = {
defaultnodegroup = {
cpu = "1"
memory = "4 GB"
replica = 1
}
}
frontend = {
defaultnodegroup = {
cpu = "1"
memory = "4 GB"
replica = 1
}
}
meta = {
defaultnodegroup = {
cpu = "1"
memory = "4 GB"
replica = 1
}
etcdmetastore = {
defaultnode_group = {
cpu = "1"
memory = "4 GB"
replica = 1
}
}
}
}
}
```
Note that 1 RWU is equivalent to 1 vCPU and 4 GB of memory.
Run the import command:
shell
terraform import risingwavecloud_cluster.my_cluster <cluster_id>
---

# risingwavecloud_cluster (Resource)

A RisingWave Cluster
A managed RisingWave Cluster on the RisingWave Cloud platform.

## Import a RisingWave Cluster

To import a RisingWave cluster, follow the steps below:

1. Get the UUID of the cluster from the RisingWave Cloud platform.

2. Write a resource definition to import the cluster. For example:

```hcl
resource "risingwavecloud_cluster" "my_cluster" {
region = "us-east-1"
name = "my_cluster"
version = "v1.8.0"
spec = {
compute = {
default_node_group = {
cpu = "2"
memory = "8 GB"
replica = 1
}
}
compactor = {
default_node_group = {
cpu = "1"
memory = "4 GB"
replica = 1
}
}
frontend = {
default_node_group = {
cpu = "1"
memory = "4 GB"
replica = 1
}
}
meta = {
default_node_group = {
cpu = "1"
memory = "4 GB"
replica = 1
}
etcd_meta_store = {
default_node_group = {
cpu = "1"
memory = "4 GB"
replica = 1
}
}
}
}
}
```

Note that 1 RWU is equivalent to 1 vCPU and 4 GB of memory.

3. Run the import command:

```shell
terraform import risingwavecloud_cluster.my_cluster <cluster_id>
```



Expand Down
41 changes: 39 additions & 2 deletions docs/resources/cluster_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,49 @@
page_title: "risingwavecloud_cluster_user Resource - terraform-provider-risingwavecloud"
subcategory: ""
description: |-
A database user in a RisingWave cluster.
A database user in a RisingWave cluster. The username and password of the dabase user are used to
connect to the RisingWave cluster.
Import a Cluster User
To import a cluster user, follow the steps below:
Get the UUID of the corrsponding cluster from the RisingWave Cloud platform.Write a resource definition to import the cluster user. For example:
hcl
resource "risingwavecloud_cluster_user" "test" {
cluster_id = "cluster-id"
username = "test-user"
password = "test-password"
}
Run the import command:
shell
terraform import risingwavecloud_cluster_user.test <cluster_id>.<username>
---

# risingwavecloud_cluster_user (Resource)

A database user in a RisingWave cluster.
A database user in a RisingWave cluster. The username and password of the dabase user are used to
connect to the RisingWave cluster.

## Import a Cluster User

To import a cluster user, follow the steps below:

1. Get the UUID of the corrsponding cluster from the RisingWave Cloud platform.

2. Write a resource definition to import the cluster user. For example:

```hcl
resource "risingwavecloud_cluster_user" "test" {
cluster_id = "cluster-id"
username = "test-user"
password = "test-password"
}
```

3. Run the import command:

```shell
terraform import risingwavecloud_cluster_user.test <cluster_id>.<username>
```



Expand Down
Loading

0 comments on commit defd2a7

Please sign in to comment.