» 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:

» 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 20 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