alicloud_adb_resource_group

更新时间:

Provides a AnalyticDB for MySQL (ADB) Resource Group resource.

For information about AnalyticDB for MySQL (ADB) Resource Group and how to use it, see What is Resource Group.

-> NOTE: Available since v1.195.0.

Example Usage

Basic Usage


variable "name" {
  default = "tf_example"
}

data "alicloud_adb_zones" "default" {
}
data "alicloud_resource_manager_resource_groups" "default" {
  status = "OK"
}

resource "alicloud_vpc" "default" {
  vpc_name   = var.name
  cidr_block = "10.4.0.0/16"
}
resource "alicloud_vswitch" "default" {
  vpc_id       = alicloud_vpc.default.id
  cidr_block   = "10.4.0.0/24"
  zone_id      = data.alicloud_adb_zones.default.zones[0].id
  vswitch_name = var.name
}

resource "alicloud_adb_db_cluster" "default" {
  compute_resource    = "48Core192GB"
  db_cluster_category = "MixedStorage"
  db_cluster_version  = "3.0"
  db_node_class       = "E32"
  db_node_storage     = 100
  description         = var.name
  elastic_io_resource = 1
  maintain_time       = "04:00Z-05:00Z"
  mode                = "flexible"
  payment_type        = "PayAsYouGo"
  resource_group_id   = data.alicloud_resource_manager_resource_groups.default.ids.0
  security_ips        = ["10.168.1.12", "10.168.1.11"]
  vpc_id              = alicloud_vpc.default.id
  vswitch_id          = alicloud_vswitch.default.id
  zone_id             = data.alicloud_adb_zones.default.zones[0].id
  tags = {
    Created = "TF",
    For     = "example",
  }
}

resource "alicloud_adb_resource_group" "default" {
  group_name    = "TF_EXAMPLE"
  group_type    = "batch"
  node_num      = 0
  db_cluster_id = alicloud_adb_db_cluster.default.id
}

Argument Reference

The following arguments are supported:

  • db_cluster_id - (Required, ForceNew) The ID of the DBCluster.
  • group_name - (Required, ForceNew) The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
  • group_type - (Optional) The query execution mode. Default value: interactive. Valid values: interactive, batch.
  • node_num - (Optional, Int) The number of nodes.
  • users - (Optional, List, Available since v1.227.0) The database accounts with which to associate the resource group.

Attributes Reference

The following attributes are exported:

  • id - The resource ID in terraform of Resource Group. It formats as <db_cluster_id>:<group_name>.
  • user - The database accounts that are associated with the resource group.
  • create_time - The time when the resource group was created.
  • update_time - The time when the resource group was updated.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 5 mins) Used when create the Resource Group.
  • update - (Defaults to 5 mins) Used when update the Resource Group.
  • delete - (Defaults to 1 mins) Used when delete the Resource Group.

Import

Adb Resource Group can be imported using the id, e.g.

$ terraform import alicloud_adb_resource_group.example <db_cluster_id>:<group_name>