alicloud_adb_cluster
Provides a ADB cluster resource. An ADB cluster is an isolated database environment in the cloud. An ADB cluster can contain multiple user-created databases.
-> DEPRECATED: This resource has been deprecated from version 1.121.0. Please use new resource alicloud_adb_db_cluster.
Example Usage
Create a ADB MySQL cluster
variable "name" {
default = "adbClusterconfig"
}
variable "creation" {
default = "ADB"
}
data "alicloud_zones" "default" {
available_resource_creation = var.creation
}
resource "alicloud_vpc" "default" {
vpc_name = var.name
cidr_block = "172.16.0.0/16"
}
resource "alicloud_vswitch" "default" {
vpc_id = alicloud_vpc.default.id
cidr_block = "172.16.0.0/24"
zone_id = data.alicloud_zones.default.zones[0].id
vswitch_name = var.name
}
resource "alicloud_adb_cluster" "default" {
db_cluster_version = "3.0"
db_cluster_category = "Cluster"
db_node_class = "C8"
db_node_count = 2
db_node_storage = 200
pay_type = "PostPaid"
description = var.name
vswitch_id = alicloud_vswitch.default.id
}
Need more examples? VIEW MORE EXAMPLES
Removing alicloud_adb_cluster from your configuration
The alicloud_adb_cluster resource allows you to manage your adb cluster, but Terraform cannot destroy it if your cluster type is pre paid(post paid type can destroy normally). Removing this resource from your configuration will remove it from your statefile and management, but will not destroy the cluster. You can resume managing the cluster via the adb Console.
Argument Reference
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 whenpayment_typeisSubscription. 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 ComputeResource -
db_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 DBClusterClass -
db_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) Fieldpay_typehas been deprecated. New fieldpayment_typeinstead. -
payment_type- (Optional) The payment type of the resource. Valid values:PayAsYouGoandSubscription. Default Value:PayAsYouGo. Note: Thepayment_typesupports updating from v1.166.0+. -
period- (Optional, Int) The duration that you will buy DB cluster (in month). It is valid whenpayment_typeisSubscription. Valid values: [1~9], 12, 24, 36.-> NOTE: The attribute
periodis only used to create Subscription instance or modify the PayAsYouGo instance to Subscription. Once effect, it will not be modified that means runningterraform applywill not affect the resource. -
renewal_status- (Optional) Valid values areAutoRenewal,Normal,NotRenewal, Default toNotRenewal. -
resource_group_id- (Optional) The ID of the resource group. -
security_ips- (Optional, List) List of IP addresses allowed to access all databases of an cluster. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). -
vswitch_id- (Optional, ForceNew) The vswitch id. -
zone_id- (Optional, ForceNew) The zone ID of the resource. -
vpc_id- (Optional, ForceNew, Available since v1.178.0) The vpc ID of the resource. -
elastic_io_resource_size- (Optional, Available since v1.207.0) The specifications of a single elastic resource node. Default Value:8Core64GB. Valid values:8Core64GB: If you setelastic_io_resource_sizeto8Core64GB, the specifications of an EIU are 24 cores and 192 GB memory.12Core96GB: If you setelastic_io_resource_sizeto12Core96GB, the specifications of an EIU are 36 cores and 288 GB memory.16Core128GB: (Available since v1.237.0)If you setelastic_io_resource_sizeto16Core128GB, the specifications of an EIU are 48 cores and 384 GB memory.
-
disk_performance_level- (Optional, Available since v1.207.0) The ESSD performance level. Default Value:PL1. Valid values:PL1,PL2,PL3. -
disk_encryption- (Optional, ForceNew, Bool, Available since v1.219.0) Specifies whether to enable disk encryption. Default Value:false. Valid values:true,false. -
kms_id- (Optional, ForceNew, Available since v1.219.0) The Key Management Service (KMS) ID that is used for disk encryption.kms_idis valid only whendisk_encryptionis set totrue. -
enable_ssl- (Optional, Bool, Available since v1.230.0) Specifies whether to enable SSL encryption. Default Value:false. Valid values:true,false. -
kernel_version- (Optional, String, Available since v1.240.0) The minor version to which you want to update. -
switch_mode- (Optional, Int, Available since v1.240.0) The time when to perform the update. Valid values:0(default): immediately performs the update.1: performs the update during the maintenance window.
-
tags- (Optional) A mapping of tags to assign to the resource.- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
-> NOTE: Because of data backup and migration, change DB cluster type and storage would cost 15~30 minutes. Please make full preparation before changing them.
Attributes Reference
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.
Timeouts
The timeouts block allows you to specify timeouts for certain actions:
create- (Defaults to 50 mins) Used when creating the adb cluster (until it reaches the initialRunningstatus).update- (Defaults to 72 mins) Used when updating the adb cluster (until it reaches the initialRunningstatus).delete- (Defaults to 50 mins) Used when terminating the adb cluster.
Import
ADB cluster can be imported using the id, e.g.
$ terraform import alicloud_adb_cluster.example am-abc12345678