Skip to content

Commit

Permalink
[CLOUDGA-17018] Add documentation + example for creating an RF5 clust…
Browse files Browse the repository at this point in the history
…er (#79)

* [CLOUDGA-17018] Add documentation + example for creating an RF5 cluster
  • Loading branch information
Arnav15 authored Oct 5, 2023
1 parent a61f1d9 commit b441437
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 0 deletions.
70 changes: 70 additions & 0 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,76 @@ resource "ybm_cluster" "multi_region_cluster" {
}
```

To create a multi-region cluster which supports upto 2 domain faults (RF 5)

```terraform
variable "password" {
type = string
description = "YSQL and YCQL Password."
sensitive = true
}
# Multi Region Cluster
resource "ybm_cluster" "multi_region_cluster" {
cluster_name = "multi-region-cluster"
cloud_type = "GCP"
cluster_type = "SYNCHRONOUS"
cluster_region_info = [
{
region = "us-west1"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "asia-east1"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "europe-central2"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "us-east1"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "us-west4"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
}
]
cluster_tier = "PAID"
cluster_allow_list_ids = ["example-allow-list-id-1", "example-allow-list-id-2"] #Optional
restore_backup_id = "example-backup-id" #Optional
fault_tolerance = "REGION"
num_faults_to_tolerate = 2
node_config = {
num_cores = 2
disk_size_gb = 50 #Optional
}
backup_schedules = [
{
state = "ACTIVE"
retention_period_in_days = 10
time_interval_in_days = 10
}
] #Optional
credentials = {
username = "example_user"
password = var.password
}
}
```

To create a multi region cluster by using distinct credentials for both YSQL and YCQL API

```terraform
Expand Down
66 changes: 66 additions & 0 deletions examples/resources/ybm_cluster/multi-region-rf5.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
variable "password" {
type = string
description = "YSQL and YCQL Password."
sensitive = true
}

# Multi Region Cluster
resource "ybm_cluster" "multi_region_cluster" {
cluster_name = "multi-region-cluster"
cloud_type = "GCP"
cluster_type = "SYNCHRONOUS"
cluster_region_info = [
{
region = "us-west1"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "asia-east1"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "europe-central2"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "us-east1"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
},
{
region = "us-west4"
num_nodes = 1
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
}

]
cluster_tier = "PAID"
cluster_allow_list_ids = ["example-allow-list-id-1", "example-allow-list-id-2"] #Optional
restore_backup_id = "example-backup-id" #Optional
fault_tolerance = "REGION"
num_faults_to_tolerate = 2
node_config = {
num_cores = 2
disk_size_gb = 50 #Optional
}
backup_schedules = [
{
state = "ACTIVE"
retention_period_in_days = 10
time_interval_in_days = 10
}
] #Optional
credentials = {
username = "example_user"
password = var.password
}
}

4 changes: 4 additions & 0 deletions templates/resources/cluster.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ To create a multi region cluster by using common credentials for both YSQL and Y

{{ tffile "examples/resources/ybm_cluster/multi-region-common-credentials.tf" }}

To create a multi-region cluster which supports upto 2 domain faults (RF 5)

{{ tffile "examples/resources/ybm_cluster/multi-region-rf5.tf" }}

To create a multi region cluster by using distinct credentials for both YSQL and YCQL API

{{ tffile "examples/resources/ybm_cluster/multi-region-distinct-credentials.tf" }}
Expand Down

0 comments on commit b441437

Please sign in to comment.