diff --git a/docs/resources/cluster.md b/docs/resources/cluster.md index b3e717d..7c1c57f 100644 --- a/docs/resources/cluster.md +++ b/docs/resources/cluster.md @@ -53,7 +53,7 @@ resource "tidbcloud_cluster" "dedicated_tier_cluster" { } } -resource "tidbcloud_cluster" "developer_tier_cluster" { +resource "tidbcloud_cluster" "serverless_tier_cluster" { project_id = "fake_id" name = "example2" cluster_type = "DEVELOPER" @@ -93,12 +93,12 @@ resource "tidbcloud_cluster" "developer_tier_cluster" { Optional: - `components` (Attributes) The components of the cluster. - - For a Developer Tier cluster, the components value can not be set. - For a Dedicated Tier cluster, the components value must be set. (see [below for nested schema](#nestedatt--config--components)) + - For a Serverless Tier cluster, the components value can not be set. - For a Dedicated Tier cluster, the components value must be set. (see [below for nested schema](#nestedatt--config--components)) - `ip_access_list` (Attributes List) A list of IP addresses and Classless Inter-Domain Routing (CIDR) addresses that are allowed to access the TiDB Cloud cluster via [standard connection](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection). (see [below for nested schema](#nestedatt--config--ip_access_list)) - `paused` (Boolean) lag that indicates whether the cluster is paused. true means to pause the cluster, and false means to resume the cluster. - The cluster can be paused only when the cluster_status is "AVAILABLE". - The cluster can be resumed only when the cluster_status is "PAUSED". - `port` (Number) The TiDB port for connection. The port must be in the range of 1024-65535 except 10080, 4000 in default. - - For a Developer Tier cluster, only port 4000 is available. + - For a Serverless Tier cluster, only port 4000 is available. - `root_password` (String) The root password to access the cluster. It must be 8-64 characters. diff --git a/docs/resources/restore.md b/docs/resources/restore.md index fff3d59..26a0187 100644 --- a/docs/resources/restore.md +++ b/docs/resources/restore.md @@ -79,14 +79,14 @@ The status of the restore task. Required: - `components` (Attributes) The components of the cluster. - - For a Developer Tier cluster, the components value can not be set. - For a Dedicated Tier cluster, the components value must be set. (see [below for nested schema](#nestedatt--config--components)) + - For a Serverless Tier cluster, the components value can not be set. - For a Dedicated Tier cluster, the components value must be set. (see [below for nested schema](#nestedatt--config--components)) - `root_password` (String) The root password to access the cluster. It must be 8-64 characters. Optional: - `ip_access_list` (Attributes List) A list of IP addresses and Classless Inter-Domain Routing (CIDR) addresses that are allowed to access the TiDB Cloud cluster via [standard connection](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection). (see [below for nested schema](#nestedatt--config--ip_access_list)) - `port` (Number) The TiDB port for connection. The port must be in the range of 1024-65535 except 10080, 4000 in default. - - For a Developer Tier cluster, only port 4000 is available. + - For a Serverless Tier cluster, only port 4000 is available. ### Nested Schema for `config.components` diff --git a/examples/resources/tidbcloud_cluster/resource.tf b/examples/resources/tidbcloud_cluster/resource.tf index dd9076b..047da48 100644 --- a/examples/resources/tidbcloud_cluster/resource.tf +++ b/examples/resources/tidbcloud_cluster/resource.tf @@ -38,7 +38,7 @@ resource "tidbcloud_cluster" "dedicated_tier_cluster" { } } -resource "tidbcloud_cluster" "developer_tier_cluster" { +resource "tidbcloud_cluster" "serverless_tier_cluster" { project_id = "fake_id" name = "example2" cluster_type = "DEVELOPER" diff --git a/internal/provider/cluster_resource.go b/internal/provider/cluster_resource.go index a79a7f7..37c4aa4 100644 --- a/internal/provider/cluster_resource.go +++ b/internal/provider/cluster_resource.go @@ -121,7 +121,7 @@ func (t clusterResourceType) GetSchema(ctx context.Context) (tfsdk.Schema, diag. }, "port": { MarkdownDescription: "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080, 4000 in default.\n" + - " - For a Developer Tier cluster, only port 4000 is available.", + " - For a Serverless Tier cluster, only port 4000 is available.", Optional: true, Computed: true, Type: types.Int64Type, @@ -138,7 +138,7 @@ func (t clusterResourceType) GetSchema(ctx context.Context) (tfsdk.Schema, diag. }, "components": { MarkdownDescription: "The components of the cluster.\n" + - " - For a Developer Tier cluster, the components value can not be set." + + " - For a Serverless Tier cluster, the components value can not be set." + " - For a Dedicated Tier cluster, the components value must be set.", Optional: true, Computed: true, @@ -268,7 +268,7 @@ func (r clusterResource) Create(ctx context.Context, req resource.CreateRequest, return } - // for DEVELOPER cluster, components is not allowed. or plan and state may be inconsistent + // for Serverless cluster, components is not allowed. or plan and state may be inconsistent if data.ClusterType == dev { if data.Config.Components != nil { resp.Diagnostics.AddError("Create Error", fmt.Sprintf("components is not allowed in %s cluster_type", dev)) @@ -460,11 +460,11 @@ func (r clusterResource) Update(ctx context.Context, req resource.UpdateRequest, return } - // DEVELOPER can not be changed now + // Severless can not be changed now if data.ClusterType == dev { resp.Diagnostics.AddError( "Update error", - "Unable to update DEVELOPER cluster", + "Unable to update Serverless cluster", ) return } diff --git a/internal/provider/restore_resource.go b/internal/provider/restore_resource.go index 80f57d7..cfc143c 100644 --- a/internal/provider/restore_resource.go +++ b/internal/provider/restore_resource.go @@ -86,7 +86,7 @@ func (t restoreResourceType) GetSchema(ctx context.Context) (tfsdk.Schema, diag. }, "port": { MarkdownDescription: "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080, 4000 in default.\n" + - " - For a Developer Tier cluster, only port 4000 is available.", + " - For a Serverless Tier cluster, only port 4000 is available.", Optional: true, Computed: true, Type: types.Int64Type, @@ -96,7 +96,7 @@ func (t restoreResourceType) GetSchema(ctx context.Context) (tfsdk.Schema, diag. }, "components": { MarkdownDescription: "The components of the cluster.\n" + - " - For a Developer Tier cluster, the components value can not be set." + + " - For a Serverless Tier cluster, the components value can not be set." + " - For a Dedicated Tier cluster, the components value must be set.", Required: true, Attributes: tfsdk.SingleNestedAttributes(map[string]tfsdk.Attribute{ diff --git a/internal/provider/testwithproject/cluster_resource_test.go b/internal/provider/testwithproject/cluster_resource_test.go index ac71738..e9c8d3d 100644 --- a/internal/provider/testwithproject/cluster_resource_test.go +++ b/internal/provider/testwithproject/cluster_resource_test.go @@ -10,14 +10,14 @@ import ( // create dedicated cluster may cause cost, make sure you have enough balance // update node_quantity is not tested for create dedicated tier needs too much time! func TestAccClusterResource(t *testing.T) { - reg, _ := regexp.Compile(".*Unable to update DEVELOPER cluster.*") + reg, _ := regexp.Compile(".*Unable to update Serverless cluster.*") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ - // Create and Read dev-tier + // Create and Read serverless tier { - Config: testAccDevClusterResourceConfig("developer-test"), + Config: testAccServerlessClusterResourceConfig("serverless-test"), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet("tidbcloud_cluster.test", "id"), resource.TestCheckResourceAttrSet("tidbcloud_cluster.test", "config.components.tidb.node_quantity"), @@ -32,7 +32,7 @@ func TestAccClusterResource(t *testing.T) { }, // Update is not supported { - Config: testAccDevClusterResourceConfig("developer-test2"), + Config: testAccServerlessClusterResourceConfig("serverless-test2"), ExpectError: reg, }, // Delete testing automatically occurs in TestCase @@ -67,7 +67,7 @@ func TestAccClusterResource(t *testing.T) { }) } -func testAccDevClusterResourceConfig(name string) string { +func testAccServerlessClusterResourceConfig(name string) string { return fmt.Sprintf(` resource "tidbcloud_cluster" "test" { project_id = %s