» alicloud_db_readonly_instance

Provides an RDS readonly instance resource.

» Example Usage

variable "creation" {
  default = "Rds"
}

variable "name" {
  default = "dbInstancevpc"
}

data "alicloud_zones" "default" {
  available_resource_creation = "${var.creation}"
}

resource "alicloud_vpc" "default" {
  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"
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"
  name              = "${var.name}"
}

resource "alicloud_db_instance" "default" {
  engine               = "MySQL"
  engine_version       = "5.6"
  instance_type        = "rds.mysql.t1.small"
  instance_storage     = "20"
  instance_charge_type = "Postpaid"
  instance_name        = "${var.name}"
  vswitch_id           = "${alicloud_vswitch.default.id}"
  security_ips         = ["10.168.1.12", "100.69.7.112"]
}

resource "alicloud_db_readonly_instance" "default" {
  master_db_instance_id = "${alicloud_db_instance.default.id}"
  zone_id               = "${alicloud_db_instance.default.zone_id}"
  engine_version        = "${alicloud_db_instance.default.engine_version}"
  instance_type         = "${alicloud_db_instance.default.instance_type}"
  instance_storage      = "30"
  instance_name         = "${var.name}ro"
  vswitch_id            = "${alicloud_vswitch.default.id}"
}

» Argument Reference

The following arguments are supported:

  • engine_version - (Required, ForceNew) Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
  • master_db_instance_id - (Required) ID of the master instance.
  • instance_type - (Required) DB Instance type. For details, see Instance type table.
  • instance_storage - (Required) User-defined DB instance storage space. Value range: [5, 2000] for MySQL/SQL Server HA dual node edition. Increase progressively at a rate of 5 GB. For details, see Instance type table.
  • instance_name - (Optional) The name of DB instance. It a string of 2 to 256 characters.
  • parameters - (Optional) Set of parameters needs to be set after DB instance was launched. Available parameters can refer to the latest docs View database parameter templates.
  • zone_id - (Optional, ForceNew) The Zone to launch the DB instance.
  • vswitch_id - (Optional, ForceNew) The virtual switch ID to launch DB instances in one VPC.
  • tags - (Optional, Available in 1.68.0+) 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.

» Attributes Reference

The following attributes are exported:

» Timeouts

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

  • create - (Defaults to 20 mins) Used when creating the db instance (until it reaches the initial Running status).
  • update - (Defaults to 30 mins) Used when updating the db instance (until it reaches the initial Running status).
  • delete - (Defaults to 20 mins) Used when terminating the db instance.

» Import

RDS readonly instance can be imported using the id, e.g.

$ terraform import alicloud_db_readonly_instance.example rm-abc12345678