Skip to content

Commit d925e8e

Browse files
author
Siddarth Baldwa
committed
Added documentation for backup replication changes via edit cluster
1 parent ab027d5 commit d925e8e

File tree

5 files changed

+465
-1
lines changed

5 files changed

+465
-1
lines changed

docs/data-sources/cluster.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ data "ybm_cluster" "example_cluster" {
4444
- `cmk_spec` (Attributes) KMS Provider Configuration. (see [below for nested schema](#nestedatt--cmk_spec))
4545
- `credentials` (Attributes) (see [below for nested schema](#nestedatt--credentials))
4646
- `database_track` (String) The track of the database. Stable or Preview.
47+
- `desired_connection_pooling_state` (String) The desired connection pooling state of the cluster, Enabled or Disabled.
4748
- `desired_state` (String) The desired state of the database, Active or Paused. This parameter can be used to pause/resume a cluster.
4849
- `endpoints` (Attributes List) The endpoints used to connect to the cluster. (see [below for nested schema](#nestedatt--endpoints))
4950
- `fault_tolerance` (String) The fault tolerance of the cluster.
@@ -82,8 +83,12 @@ Read-Only:
8283

8384
Read-Only:
8485

86+
- `backup_region` (Boolean) Indicates whether cluster backup data will be stored in this region.
87+
- `backup_replication_gcp_target` (String) GCS bucket name set as backup replication target.
8588
- `disk_iops` (Number)
8689
- `disk_size_gb` (Number)
90+
- `is_default` (Boolean)
91+
- `is_preferred` (Boolean)
8792
- `num_cores` (Number)
8893
- `num_nodes` (Number)
8994
- `public_access` (Boolean)

docs/resources/cluster.md

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,233 @@ resource "ybm_private_service_endpoint" "npsenonok-region" {
595595
}
596596
```
597597

598+
To edit a GCP Cluster with backup replication
599+
600+
```terraform
601+
variable "password" {
602+
type = string
603+
description = "YSQL and YCQL Password."
604+
sensitive = true
605+
}
606+
607+
# Comprehensive Backup Replication Examples
608+
# This file demonstrates different backup replication strategies for various cluster types
609+
610+
# 1. Single Region Cluster with Backup Replication
611+
resource "ybm_cluster" "single_region_backup_replication" {
612+
cluster_name = "single-region-backup-replication"
613+
cloud_type = "GCP"
614+
cluster_type = "SYNCHRONOUS"
615+
cluster_region_info = [
616+
{
617+
region = "us-west1"
618+
num_nodes = 1
619+
num_cores = 2
620+
disk_size_gb = 50
621+
vpc_id = "example-vpc-id"
622+
public_access = true
623+
backup_replication_gcp_target = "single-region-backup-bucket"
624+
}
625+
]
626+
cluster_tier = "PAID"
627+
cluster_allow_list_ids = ["example-allow-list-id"]
628+
fault_tolerance = "NONE"
629+
630+
backup_schedules = [
631+
{
632+
state = "ACTIVE"
633+
retention_period_in_days = 30
634+
time_interval_in_days = 7
635+
}
636+
]
637+
638+
credentials = {
639+
username = "example_user"
640+
password = var.password
641+
}
642+
}
643+
644+
# 2. Multi-Region SYNCHRONOUS Cluster with Centralized Backup
645+
# All regions backup to the same GCS bucket
646+
resource "ybm_cluster" "multi_region_sync_centralized_backup" {
647+
cluster_name = "multi-region-sync-centralized-backup"
648+
cloud_type = "GCP"
649+
cluster_type = "SYNCHRONOUS"
650+
cluster_region_info = [
651+
{
652+
region = "us-west1"
653+
num_nodes = 1
654+
num_cores = 2
655+
disk_size_gb = 50
656+
vpc_id = "example-vpc-id-1"
657+
public_access = true
658+
backup_replication_gcp_target = "central-backup-bucket" # Same for all regions
659+
},
660+
{
661+
region = "us-central1"
662+
num_nodes = 1
663+
num_cores = 2
664+
disk_size_gb = 50
665+
vpc_id = "example-vpc-id-2"
666+
public_access = true
667+
backup_replication_gcp_target = "central-backup-bucket" # Same for all regions
668+
},
669+
{
670+
region = "us-east1"
671+
num_nodes = 1
672+
num_cores = 2
673+
disk_size_gb = 50
674+
vpc_id = "example-vpc-id-3"
675+
public_access = true
676+
backup_replication_gcp_target = "central-backup-bucket" # Same for all regions
677+
}
678+
]
679+
cluster_tier = "PAID"
680+
cluster_allow_list_ids = ["example-allow-list-id"]
681+
fault_tolerance = "REGION"
682+
683+
backup_schedules = [
684+
{
685+
state = "ACTIVE"
686+
retention_period_in_days = 30
687+
time_interval_in_days = 7
688+
}
689+
]
690+
691+
credentials = {
692+
username = "example_user"
693+
password = var.password
694+
}
695+
}
696+
697+
# 3. Multi-Region GEO_PARTITIONED Cluster with Region-Specific Backup
698+
# Each region can have different backup targets for compliance or performance reasons
699+
resource "ybm_cluster" "multi_region_geo_region_specific_backup" {
700+
cluster_name = "multi-region-geo-region-specific-backup"
701+
cloud_type = "GCP"
702+
cluster_type = "GEO_PARTITIONED"
703+
cluster_region_info = [
704+
{
705+
region = "us-west1"
706+
num_nodes = 1
707+
num_cores = 2
708+
disk_size_gb = 50
709+
vpc_id = "example-vpc-id-1"
710+
public_access = true
711+
backup_replication_gcp_target = "us-west-backup-bucket" # Region-specific
712+
},
713+
{
714+
region = "asia-east1"
715+
num_nodes = 1
716+
num_cores = 2
717+
disk_size_gb = 50
718+
vpc_id = "example-vpc-id-2"
719+
public_access = true
720+
backup_replication_gcp_target = "asia-east-backup-bucket" # Region-specific
721+
},
722+
{
723+
region = "europe-central2"
724+
num_nodes = 1
725+
num_cores = 2
726+
disk_size_gb = 50
727+
vpc_id = "example-vpc-id-3"
728+
public_access = true
729+
backup_replication_gcp_target = "europe-central-backup-bucket" # Region-specific
730+
}
731+
]
732+
cluster_tier = "PAID"
733+
cluster_allow_list_ids = ["example-allow-list-id"]
734+
fault_tolerance = "REGION"
735+
736+
backup_schedules = [
737+
{
738+
state = "ACTIVE"
739+
retention_period_in_days = 30
740+
time_interval_in_days = 7
741+
}
742+
]
743+
744+
credentials = {
745+
username = "example_user"
746+
password = var.password
747+
}
748+
}
749+
750+
# 4. Asymmetric GEO_PARTITIONED Cluster with Mixed Backup Strategy
751+
# Some regions share backup targets, others have unique targets
752+
resource "ybm_cluster" "asymmetric_geo_mixed_backup" {
753+
cluster_name = "asymmetric-geo-mixed-backup"
754+
cloud_type = "GCP"
755+
cluster_type = "GEO_PARTITIONED"
756+
cluster_region_info = [
757+
{
758+
region = "us-west1"
759+
num_nodes = 1
760+
num_cores = 2
761+
disk_size_gb = 50
762+
vpc_id = "example-vpc-id-1"
763+
public_access = true
764+
backup_replication_gcp_target = "us-west-backup-bucket"
765+
},
766+
{
767+
region = "us-central1"
768+
num_nodes = 1
769+
num_cores = 4
770+
disk_size_gb = 100
771+
vpc_id = "example-vpc-id-2"
772+
public_access = true
773+
backup_replication_gcp_target = "us-central-backup-bucket"
774+
},
775+
{
776+
region = "us-east1"
777+
num_nodes = 1
778+
num_cores = 4
779+
disk_size_gb = 100
780+
vpc_id = "example-vpc-id-3"
781+
public_access = true
782+
backup_replication_gcp_target = "us-central-backup-bucket" # Same as us-central1
783+
}
784+
]
785+
cluster_tier = "PAID"
786+
cluster_allow_list_ids = ["example-allow-list-id"]
787+
fault_tolerance = "REGION"
788+
789+
backup_schedules = [
790+
{
791+
state = "ACTIVE"
792+
retention_period_in_days = 30
793+
time_interval_in_days = 7
794+
}
795+
]
796+
797+
credentials = {
798+
username = "example_user"
799+
password = var.password
800+
}
801+
}
802+
803+
# Important Notes:
804+
#
805+
# 1. backup_replication_gcp_target can ONLY be set when editing existing clusters
806+
# - It will be ignored during initial cluster creation
807+
# - To add backup replication, first create the cluster, then update the configuration
808+
#
809+
# 2. Cluster Type Rules:
810+
# - SYNCHRONOUS: All regions MUST have the same backup_replication_gcp_target
811+
# - GEO_PARTITIONED: Each region can have different backup_replication_gcp_target values. This allows for region-specific backup strategies and compliance requirements
812+
#
813+
# 3. Requirements:
814+
# - Only supported for GCP clusters
815+
# - Only supported for PAID tier clusters
816+
# - All regions must have backup_replication_gcp_target if any are provided
817+
#
818+
# 4. Use Cases:
819+
# - Centralized backup strategy (SYNCHRONOUS clusters)
820+
# - Region-specific compliance requirements (GEO_PARTITIONED clusters)
821+
# - Performance optimization by keeping backups close to data
822+
# - Disaster recovery planning with multiple backup locations
823+
```
824+
598825

599826
<!-- schema generated by tfplugindocs -->
600827
## Schema
@@ -616,6 +843,7 @@ resource "ybm_private_service_endpoint" "npsenonok-region" {
616843
- `cluster_allow_list_ids` (List of String) List of IDs of the allow lists assigned to the cluster.
617844
- `cmk_spec` (Attributes) KMS Provider Configuration. (see [below for nested schema](#nestedatt--cmk_spec))
618845
- `database_track` (String) The track of the database. Production or Innovation or Preview.
846+
- `desired_connection_pooling_state` (String) The desired connection pooling state of the cluster, Enabled or Disabled. This parameter can be used to enable/disable Connection Pooling
619847
- `desired_state` (String) The desired state of the cluster, Active or Paused. This parameter can be used to pause/resume a cluster.
620848
- `fault_tolerance` (String) The fault tolerance of the cluster. NONE, NODE, ZONE or REGION.
621849
- `node_config` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--node_config))
@@ -643,6 +871,7 @@ Required:
643871

644872
Optional:
645873

874+
- `backup_replication_gcp_target` (String) GCS bucket name for backup replication target. Only configurable when editing existing clusters. For SYNCHRONOUS clusters, all regions must have the same target. For GEO_PARTITIONED clusters, each region can have different targets. Only supported for GCP clusters and PAID tier.
646875
- `disk_iops` (Number) Disk IOPS of the nodes of the region.
647876
- `disk_size_gb` (Number) Disk size of the nodes of the region.
648877
- `is_default` (Boolean)
@@ -652,6 +881,10 @@ Optional:
652881
- `vpc_id` (String)
653882
- `vpc_name` (String)
654883

884+
Read-Only:
885+
886+
- `backup_region` (Boolean) Indicates whether cluster backup data will be stored in this region.
887+
655888

656889
<a id="nestedatt--credentials"></a>
657890
### Nested Schema for `credentials`

0 commit comments

Comments
 (0)