» alicloud_kvstore_instance

Provides an ApsaraDB Redis / Memcache instance resource. A DB instance is an isolated database environment in the cloud. It can be associated with IP whitelists and backup configuration which are separate resource providers.

» Example Usage

Basic Usage

variable "creation" {
  default = "KVStore"
variable "name" {
  default = "kvstoreinstancevpc"
data "alicloud_zones" "default" {
  available_resource_creation = "${var.creation}"
resource "alicloud_vpc" "default" {
  name       = "${var.name}"
  cidr_block = ""
resource "alicloud_vswitch" "default" {
  vpc_id            = "${alicloud_vpc.default.id}"
  cidr_block        = ""
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"
  name              = "${var.name}"
resource "alicloud_kvstore_instance" "default" {
  instance_class = "redis.master.small.default"
  instance_name  = "${var.name}"
  vswitch_id     = "${alicloud_vswitch.default.id}"
  private_ip     = ""
  security_ips   = [""]
  instance_type  = "Redis"
  engine_version = "4.0"

» Argument Reference

The following arguments are supported:

  • instance_name - (Optional) The name of DB instance. It a string of 2 to 256 characters.
  • password- (Optional, Sensitive) The password of the DB instance. The password is a string of 8 to 30 characters and must contain uppercase letters, lowercase letters, and numbers.
  • kms_encrypted_password - (Optional, Available in 1.57.1+) An KMS encrypts password used to a instance. If the password is filled in, this field will be ignored.
  • kms_encryption_context - (Optional, MapString, Available in 1.57.1+) An KMS encryption context used to decrypt kms_encrypted_password before creating or updating instance with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.
  • instance_class - (Required) Type of the applied ApsaraDB for Redis instance. It can be retrieved by data source alicloud_kvstore_instance_classes or referring to help-docs Instance type table.
  • availability_zone - (Optional, ForceNew) The Zone to launch the DB instance.
  • instance_charge_type - (Optional) Valid values are PrePaid, PostPaid, Default to PostPaid.
  • period - (Optional) The duration that you will buy DB instance (in month). It is valid when instance_charge_type is PrePaid. Valid values: [1~9], 12, 24, 36. Default to 1.
  • auto_renew - (Optional, Available in 1.36.0+) Whether to renewal a DB instance automatically or not. It is valid when instance_charge_type is PrePaid. Default to false.
  • auto_renew_period - (Optional, Available in 1.36.0+) Auto-renewal period of an instance, in the unit of the month. It is valid when instance_charge_type is PrePaid. Valid value:[1~12], Default to 1.
  • instance_type - (Optional, ForceNew) The engine to use: Redis or Memcache. Defaults to Redis.
  • vswitch_id - (Optional, ForceNew) The ID of VSwitch.
  • engine_version- (Optional, ForceNew) Engine version. Supported values: 2.8, 4.0 and 5.0. Default value: 2.8. Only 2.8 can be supported for Memcache Instance.
  • security_ips- (Optional) Set the instance's IP whitelist of the default security group.
  • security_group_id - (Optional, Available in 1.76.0+) The Security Group ID of ECS.
  • private_ip- (Optional) Set the instance's private IP.
  • backup_id- (Optional) If an instance created based on a backup set generated by another instance is valid, this parameter indicates the ID of the generated backup set.
  • vpc_auth_mode- (Optional) Only meaningful if instance_type is Redis and network type is VPC. Valid values are Close, Open. Defaults to Open. Close means the redis instance can be accessed without authentication. Open means authentication is required.
  • parameters - (Optional) Set of parameters needs to be set after instance was launched. Available parameters can refer to the latest docs Instance configurations table .
  • tags - (Optional, Available in v1.55.3+) A mapping of tags to assign to the resource.
  • maintain_start_time - (Optional, Available in v1.56.0+) The start time of the operation and maintenance time period of the instance, in the format of HH:mmZ (UTC time).
  • maintain_end_time - (Optional, Available in v1.56.0+) The end time of the operation and maintenance time period of the instance, in the format of HH:mmZ (UTC time).
  • resource_group_id - (Optional, ForceNew, Available in v1.86.0+) The ID of resource group which the resource belongs.

» Attributes Reference

The following attributes are exported:

  • id - The KVStore instance ID.
  • connection_domain - Instance connection domain (only Intranet access supported).

» Timeouts

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

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

» Import

KVStore instance can be imported using the id, e.g.

$ terraform import alicloud_kvstore_instance.example r-abc12345678