alicloud_adb_account
更新时间:
Provides a ADB account resource and used to manage databases.
-> NOTE: Available since v1.71.0.
Example Usage
variable "creation" {
default = "ADB"
}
variable "name" {
default = "tfexample"
}
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
}
resource "alicloud_adb_account" "default" {
db_cluster_id = alicloud_adb_db_cluster.cluster.id
account_name = var.name
account_password = "tf_example123"
account_description = var.name
}
Argument Reference
The following arguments are supported:
db_cluster_id
- (Required, ForceNew) The Id of cluster in which account belongs.account_name
- (Required, ForceNew) Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.account_password
- (Optional) Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one ofaccount_password
andkms_encrypted_password
fields.kms_encrypted_password
- (Optional) An KMS encrypts password used to a db account. If theaccount_password
is filled in, this field will be ignored.kms_encryption_context
- (Optional) An KMS encryption context used to decryptkms_encrypted_password
before creating or updating a db account withkms_encrypted_password
. See Encryption Context. It is valid whenkms_encrypted_password
is set.account_description
- (Optional) Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.account_type
- (Optional, ForceNew) The type of the database account. Default Value:Super
. Valid values:Normal
: standard account. Up to 256 standard accounts can be created for a cluster.Super
: privileged account. Only a single privileged account can be created for a cluster.
Attributes Reference
The following attributes are exported:
id
- The current account resource ID. Composed of instance ID and account name with format<instance_id>:<name>
.
Import
ADB account can be imported using the id, e.g.
$ terraform import alicloud_adb_account.example am-12345:tf_account
文档内容是否对您有帮助?