» 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 = "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_kvstore_instance" "default" {
        instance_class = "redis.master.small.default"
        instance_name  = "${var.name}"
        vswitch_id     = "${alicloud_vswitch.default.id}"
        private_ip     = "172.16.0.10"
        security_ips = ["10.0.0.1"]
        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) 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.
  • instance_class - (Required) Type of the applied ApsaraDB for Redis instance. For more information, see 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 and 4.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.
  • 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 .

» Attributes Reference

The following attributes are exported:

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

» Import

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

$ terraform import alicloud_kvstore_instance.example r-abc12345678