alicloud_adb_lake_account

更新时间:

Provides a ADB Lake Account resource. Account of the DBClusterLakeVesion.

For information about ADB Lake Account and how to use it, see What is Lake Account. For information about ADB Lake Account Privileges and how to use it, see What are Lake Account Privileges.

-> NOTE: Available since v1.214.0.

Example Usage

Basic Usage


variable "name" {
  default = "terraform-example"
}

provider "alicloud" {
  region = "cn-hangzhou"
}

data "alicloud_zones" "default" {
  available_resource_creation = "VSwitch"
}

resource "alicloud_vpc" "VPCID" {
  vpc_name = var.name

  cidr_block = "172.16.0.0/12"
}

resource "alicloud_vswitch" "VSWITCHID" {
  vpc_id       = alicloud_vpc.VPCID.id
  zone_id      = "cn-hangzhou-k"
  vswitch_name = var.name

  cidr_block = "172.16.0.0/24"
}

resource "alicloud_adb_db_cluster_lake_version" "CreateInstance" {
  storage_resource       = "0ACU"
  zone_id                = "cn-hangzhou-k"
  vpc_id                 = alicloud_vpc.VPCID.id
  vswitch_id             = alicloud_vswitch.VSWITCHID.id
  db_cluster_description = var.name
  compute_resource       = "16ACU"
  db_cluster_version     = "5.0"
  payment_type           = "PayAsYouGo"
  security_ips           = "127.0.0.1"
}


resource "alicloud_adb_lake_account" "default" {
  db_cluster_id    = alicloud_adb_db_cluster_lake_version.CreateInstance.id
  account_type     = "Super"
  account_name     = "tfnormal"
  account_password = "normal@2023"
  account_privileges {
    privilege_type = "Database"
    privilege_object {
      database = "MYSQL"
    }

    privileges = [
      "select",
      "update"
    ]
  }
  account_privileges {
    privilege_type = "Table"
    privilege_object {
      database = "INFORMATION_SCHEMA"
      table    = "ENGINES"
    }

    privileges = [
      "update"
    ]
  }
  account_privileges {
    privilege_type = "Column"
    privilege_object {
      table    = "COLUMNS"
      column   = "PRIVILEGES"
      database = "INFORMATION_SCHEMA"
    }

    privileges = [
      "update"
    ]
  }

  account_description = var.name
}

Argument Reference

The following arguments are supported:

  • account_description - (Optional) The description of the account.
  • account_name - (Required, ForceNew) The name of the account.
  • account_password - (Required) AccountPassword.
  • account_privileges - (Optional) List of permissions granted. See account_privileges below.
  • account_type - (Optional, ForceNew) The type of the account.
  • db_cluster_id - (Required, ForceNew) The DBCluster ID.

account_privileges

The account_privileges supports the following:

  • privilege_object - (Optional) Object associated to privileges. See privilege_object below.
  • privilege_type - (Optional) The type of privileges.
  • privileges - (Optional) privilege list.

account_privileges-privilege_object

The privilege_object supports the following:

  • column - (Optional) The name of column.
  • database - (Optional) The name of database.
  • table - (Optional) The name of table.

Attributes Reference

The following attributes are exported:

  • id - The ID of the resource supplied above.The value is formulated as <db_cluster_id>:<account_name>.
  • status - The status of the resource.

Timeouts

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

  • create - (Defaults to 5 mins) Used when create the Lake Account.
  • delete - (Defaults to 5 mins) Used when delete the Lake Account.
  • update - (Defaults to 5 mins) Used when update the Lake Account.

Import

ADB Lake Account can be imported using the id, e.g.

$ terraform import alicloud_adb_lake_account.example <db_cluster_id>:<account_name>