Skip to content

Latest commit

 

History

History
198 lines (147 loc) · 8.32 KB

File metadata and controls

198 lines (147 loc) · 8.32 KB
page_title subcategory description
tidbcloud_cluster Resource - terraform-provider-tidbcloud
cluster resource

tidbcloud_cluster (Resource)

cluster resource

Example Usage

terraform {
  required_providers {
    tidbcloud = {
      source = "tidbcloud/tidbcloud"
    }
  }
}

provider "tidbcloud" {
  public_key  = "fake_public_key"
  private_key = "fake_private_key"
  sync        = true
}

resource "tidbcloud_cluster" "dedicated_tier_cluster" {
  project_id     = "fake_id"
  name           = "example1"
  cluster_type   = "DEDICATED"
  cloud_provider = "AWS"
  region         = "us-east-1"
  config = {
    root_password = "Fake_root_password1"
    components = {
      tidb = {
        node_size : "8C16G"
        node_quantity : 1
      }
      tikv = {
        node_size : "8C32G"
        storage_size_gib : 500,
        node_quantity : 3
      }
      tiflash = {
        node_size : "8C64G"
        storage_size_gib : 2048,
        node_quantity : 2
      }
    }
  }
}

resource "tidbcloud_cluster" "serverless_tier_cluster" {
  project_id     = "fake_id"
  name           = "example2"
  cluster_type   = "DEVELOPER"
  cloud_provider = "AWS"
  region         = "us-east-1"
  config = {
    root_password = "Fake_root_password1"
  }
}

Schema

Required

  • cloud_provider (String) Enum: "AWS" "GCP", The cloud provider on which your TiDB cluster is hosted.
  • cluster_type (String) Enum: "DEDICATED" "DEVELOPER", The cluster type.
  • config (Attributes) The configuration of the cluster. (see below for nested schema)
  • name (String) The name of the cluster.
  • project_id (String) The ID of the project. You can get the project ID from tidbcloud_projects datasource.
  • region (String) the region value should match the cloud provider's region code. You can get the complete list of available regions from the tidbcloud_cluster_specs datasource.

Read-Only

  • create_timestamp (String) The creation time of the cluster in Unix timestamp seconds (epoch time).
  • id (String) The ID of the cluster.
  • status (Attributes) The status of the cluster. (see below for nested schema)

Nested Schema for config

Optional:

  • components (Attributes) The components of the cluster.
    • 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)
  • 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. (see below for nested schema)
  • 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 Serverless Tier cluster, only port 4000 is available.
  • root_password (String) The root password to access the cluster. It must be 8-64 characters.

Nested Schema for config.components

Required:

Optional:

Nested Schema for config.components.tidb

Required:

  • node_quantity (Number) The number of nodes in the cluster. You can get the minimum and step of a node quantity from the tidbcloud_cluster_specs datasource.
  • node_size (String) The size of the TiDB component in the cluster, You can get the available node size of each region from the tidbcloud_cluster_specs datasource.
    • If the vCPUs of TiDB or TiKV component is 2 or 4, then their vCPUs need to be the same.
    • If the vCPUs of TiDB or TiKV component is 2 or 4, then the cluster does not support TiFlash.
    • Can not modify node_size of an existing cluster.

Nested Schema for config.components.tikv

Required:

  • node_quantity (Number) The number of nodes in the cluster. You can get the minimum and step of a node quantity from the tidbcloud_cluster_specs datasource.
    • TiKV do not support decreasing node quantity.
    • The node_quantity of TiKV must be a multiple of 3.
  • node_size (String) The size of the TiKV component in the cluster, You can get the available node size of each region from the tidbcloud_cluster_specs datasource.
    • If the vCPUs of TiDB or TiKV component is 2 or 4, then their vCPUs need to be the same.
    • If the vCPUs of TiDB or TiKV component is 2 or 4, then the cluster does not support TiFlash.
    • Can not modify node_size of an existing cluster.
  • storage_size_gib (Number) The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the tidbcloud_cluster_specs datasource.
    • Can not modify storage_size_gib of an existing cluster.

Nested Schema for config.components.tiflash

Required:

  • node_quantity (Number) The number of nodes in the cluster. You can get the minimum and step of a node quantity from the tidbcloud_cluster_specs datasource.
    • TiFlash do not support decreasing node quantity.
  • node_size (String) The size of the TiFlash component in the cluster, You can get the available node size of each region from the tidbcloud_cluster_specs datasource.
    • Can not modify node_size of an existing cluster.
  • storage_size_gib (Number) The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the tidbcloud_cluster_specs datasource.
    • Can not modify storage_size_gib of an existing cluster.

Nested Schema for config.ip_access_list

Required:

  • cidr (String) The IP address or CIDR range that you want to add to the cluster's IP access list.
  • description (String) Description that explains the purpose of the entry.

Nested Schema for status

Read-Only:

  • cluster_status (String) Status of the cluster.
  • connection_strings (Attributes) Connection strings. (see below for nested schema)
  • tidb_version (String) TiDB version.

Nested Schema for status.connection_strings

Read-Only:

Nested Schema for status.connection_strings.standard

Read-Only:

  • host (String) The host of standard connection.
  • port (Number) The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.

Nested Schema for status.connection_strings.vpc_peering

Read-Only:

  • host (String) The host of VPC peering connection.
  • port (Number) The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.