in alibabacloudstack/resource_apsarastack_kvstore_instance.go [23:219]
func resourceAlibabacloudStackKVStoreInstance() *schema.Resource {
resource := &schema.Resource{
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(40 * time.Minute),
Update: schema.DefaultTimeout(30 * time.Minute),
Delete: schema.DefaultTimeout(40 * time.Minute),
},
Schema: map[string]*schema.Schema{
"tair_instance_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringLenBetween(2, 128),
ConflictsWith: []string{"instance_name"},
},
"instance_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringLenBetween(2, 128),
Deprecated: "Field 'instance_name' is deprecated and will be removed in a future release. Please use new field 'tair_instance_name' instead.",
ConflictsWith: []string{"tair_instance_name"},
},
"password": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
},
"kms_encrypted_password": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: kmsDiffSuppressFunc,
},
"kms_encryption_context": {
Type: schema.TypeMap,
Optional: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return d.Get("kms_encrypted_password").(string) == ""
},
Elem: schema.TypeString,
},
"instance_class": {
Type: schema.TypeString,
Required: true,
},
"engine_version": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Default: KVStore5Dot0,
},
"zone_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
ConflictsWith: []string{"availability_zone"},
},
"availability_zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Deprecated: "Field 'availability_zone' is deprecated and will be removed in a future release. Please use new field 'zone_id' instead.",
ConflictsWith: []string{"zone_id"},
},
"instance_charge_type": {
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice([]string{string(PrePaid), string(PostPaid)}, false),
Optional: true,
Computed: true,
Deprecated: "Field 'instance_charge_type' is deprecated and will be removed in a future release, and not for any use now.",
},
"instance_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: string(KVStoreRedis),
ValidateFunc: validation.StringInSlice([]string{
string(KVStoreMemcache),
string(KVStoreRedis),
}, false),
},
"vswitch_id": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
},
"connection_domain": {
Type: schema.TypeString,
Computed: true,
},
"private_ip": {
Type: schema.TypeString,
Computed: true,
// Optional: true, ASCM不支持设定
},
"backup_id": {
Type: schema.TypeString,
Optional: true,
},
"security_ips": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
Optional: true,
},
"vpc_auth_mode": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"Open", "Close"}, false),
},
"parameters": {
Type: schema.TypeSet,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"value": {
Type: schema.TypeString,
Required: true,
},
},
},
Set: func(v interface{}) int {
return hashcode.String(
v.(map[string]interface{})["name"].(string) + "|" + v.(map[string]interface{})["value"].(string))
},
Optional: true,
Computed: true,
},
"maintain_start_time": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"maintain_end_time": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"cpu_type": {
Type: schema.TypeString,
Optional: true,
Deprecated: "Field 'cpu_type' is deprecated and will be removed in a future release.",
},
"node_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"MASTER_SLAVE", "STAND_ALONE", "double", "readone"}, false),
DiffSuppressFunc: NodeTypeDiffSuppressFunc,
},
"architecture_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"cluster", "rwsplit", "standard"}, false),
DiffSuppressFunc: ArchitectureTypeDiffSuppressFunc,
},
"series": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"community", "enterprise"}, false),
},
"tde_status": {
Type: schema.TypeString,
Optional: true,
},
"encryption_key": {
Type: schema.TypeString,
Optional: true,
Deprecated: "TDE does not support the simultaneous use of `encryption_key` and `role_arn`.",
ConflictsWith: []string{"role_arn"},
},
"role_arn": {
Type: schema.TypeString,
Optional: true,
Deprecated: "TDE does not support the simultaneous use of `encryption_key` and `role_arn`.",
ConflictsWith: []string{"encryption_key"},
},
},
}
setResourceFunc(resource, resourceAlibabacloudStackKVStoreInstanceCreate,
resourceAlibabacloudStackKVStoreInstanceRead, resourceAlibabacloudStackKVStoreInstanceUpdate, resourceAlibabacloudStackKVStoreInstanceDelete)
return resource
}