Provides a AnalyticDB for MySQL (ADB) DBCluster resource.
For information about AnalyticDB for MySQL (ADB) DBCluster and how to use it, see What is DBCluster.
Basic Usage
variable "name" {
default = "terraform-example"
}
data "alicloud_adb_zones" "default" {
}
data "alicloud_vpcs" "default" {
name_regex = "^default-NODELETING$"
}
data "alicloud_vswitches" "default" {
vpc_id = data.alicloud_vpcs.default.ids.0
zone_id = data.alicloud_adb_zones.default.ids.0
}
locals {
vswitch_id = data.alicloud_vswitches.default.ids.0
}
resource "alicloud_adb_db_cluster" "cluster" {
db_cluster_category = "MixedStorage"
mode = "flexible"
compute_resource = "8Core32GB"
vswitch_id = local.vswitch_id
description = var.name
}
The alicloud_adb_cluster resource allows you to manage your adb cluster, but Terraform cannot destroy it if your cluster type is PrePaid(PostPaid type can destroy normally). Removing this resource from your configuration will remove it from your state file and management, but will not destroy the cluster. You can resume managing the cluster via the adb Console.
The following arguments are supported:
auto_renew_period
- (Optional, Int) Auto-renewal period of an cluster, in the unit of the month. It is valid when payment_type
is Subscription
. Valid values: 1
, 2
, 3
, 6
, 12
, 24
, 36
. Default Value: 1
.compute_resource
- (Optional) The specifications of computing resources in elastic mode. The increase of resources can speed up queries. AnalyticDB for MySQL automatically scales computing resources. For more information, see ComputeResourcedb_cluster_category
- (Required) The db cluster category. Valid values: Basic
, Cluster
, MixedStorage
.db_cluster_class
- (Deprecated since v1.121.2) It duplicates with attribute db_node_class and is deprecated from 1.121.2.db_cluster_version
- (Optional, ForceNew) The db cluster version. Valid values: 3.0
. Default Value: 3.0
.db_node_class
- (Optional) The db node class. For more information, see DBClusterClassdb_node_count
- (Optional, Int) The db node count.db_node_storage
- (Optional, Int) The db node storage.description
- (Optional) The description of DBCluster.elastic_io_resource
- (Optional, Int) The elastic io resource.maintain_time
- (Optional) The maintenance window of the cluster. Format: hh:mmZ-hh:mmZ.mode
- (Required) The mode of the cluster. Valid values: reserver
, flexible
.modify_type
- (Optional) The modify type.pay_type
- (Deprecated since v1.166.0) Field pay_type
has been deprecated. New field payment_type
instead.payment_type
- (Optional) The payment type of the resource. Valid values: PayAsYouGo
and Subscription
. Default Value: PayAsYouGo
. Note: The payment_type
supports updating from v1.166.0+.period
- (Optional, Int) The duration that you will buy DB cluster (in month). It is valid when payment_type
is Subscription
. Valid values: [1~9], 12, 24, 36.
The following attributes are exported:
id
- The resource ID in terraform of DBCluster.connection_string
- The connection string of the cluster.port
- (Available since v1.196.0) The connection port of the ADB cluster.status
- The status of the resource.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 120 mins) Used when create the DBCluster.update
- (Defaults to 6 hours) Used when update the DBCluster.delete
- (Defaults to 3 hours) Used when delete the DBCluster.AnalyticDB for MySQL (ADB) DBCluster can be imported using the id, e.g.
$ terraform import alicloud_adb_db_cluster.example <id>