-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2fa237
commit 61b56ff
Showing
9 changed files
with
544 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
subcategory: "Distributed Cache Service (DCS)" | ||
--- | ||
|
||
# flexibleengine_dcs_flavors_v1_v1 | ||
|
||
Use this data source to get a list of available DCS flavors. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "flexibleengine_dcs_flavors_v1" "flavors" { | ||
capacity = "4" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String) Specifies the region in which to obtain the DCS flavors. | ||
If omitted, the provider-level region will be used. | ||
|
||
* `capacity` - (Required, Float) The total memory of the cache, in GB. | ||
+ **Redis4.0, Redis5.0 and Redis6.0**: Stand-alone and active/standby type instance values: | ||
`0.125`, `0.25`, `0.5`, `1`, `2`, `4`, `8`, `16`, `32` and `64`. | ||
Cluster instance specifications support `4`,`8`,`16`,`24`, `32`, `48`, `64`, `96`, `128`, `192`, | ||
`256`, `384`, `512`, `768` and `1024`. | ||
+ **Redis3.0**: Stand-alone and active/standby type instance values: `2`, `4`, `8`, `16`, `32` and `64`. | ||
Proxy cluster instance specifications support `64`, `128`, `256`, `512`, and `1024`. | ||
+ **Memcached**: Stand-alone and active/standby type instance values: `2`, `4`, `8`, `16`, `32` and `64`. | ||
|
||
* `engine` - (Optional, String) The engine of the cache instance. Valid values are *Redis* and *Memcached*. | ||
Default value is *Redis*. | ||
|
||
* `engine_version` - (Optional, String) The version of a cache engine. | ||
It is mandatory when the engine is *Redis*, the value can be `3.0`, `4.0`, `5.0`, or `6.0`. | ||
|
||
* `cache_mode` - (Optional, String) The mode of a cache engine. The valid values are as follows: | ||
+ `single` - Single-node. | ||
+ `ha` - Master/Standby. | ||
+ `cluster` - Redis Cluster. | ||
+ `proxy` - Proxy Cluster. Redis6.0 not support this mode. | ||
+ `ha_rw_split` - Read/Write splitting. Redis6.0 not support this mode. | ||
|
||
* `name` - (Optional, String) The flavor name of the cache instance. | ||
|
||
* `cpu_architecture` - (Optional, String) The CPU architecture of cache instance. | ||
Valid values *x86_64* and *aarch64*. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `flavors` - A list of DCS flavors. | ||
|
||
The `flavors` block supports: | ||
|
||
* `name` - The flavor name of the cache instance. | ||
|
||
* `cache_mode` - The mode of a cache instance. | ||
|
||
* `engine` - The engine of the cache instance. Value is *redis* or *memcached*. | ||
|
||
* `engine_versions` - Supported versions of the specification. | ||
|
||
* `cpu_architecture` - The CPU architecture of cache instance. Value is *x86_64* or *aarch64*. | ||
|
||
* `capacity` - The total memory of the cache, in GB. | ||
|
||
* `available_zones` - An array of available zones where the cache specification can be used. | ||
|
||
* `ip_count` - Number of IP addresses corresponding to the specifications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
subcategory: "Distributed Cache Service (DCS)" | ||
--- | ||
|
||
# flexibleengine_dcs_instances_v1 | ||
|
||
Use this data source to get the list of DCS instances. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "flexibleengine_dcs_instances_v1" "test" { | ||
name = "test_name" | ||
status = "RUNNING" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String) Specifies the region in which to query the data source. | ||
If omitted, the provider-level region will be used. | ||
|
||
* `name` - (Optional, String) Specifies the name of an instance. | ||
|
||
* `status` - (Optional, String) Specifies the cache instance status. The valid values are **RUNNING**, **ERROR**, | ||
**RESTARTING**, **FROZEN**, **EXTENDING**, **RESTORING**, **FLUSHING**. | ||
|
||
* `private_ip` - (Optional, String) Specifies the subnet Network ID. | ||
|
||
* `capacity` - (Optional, Float) Specifies the cache capacity. Unit: GB. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The resource ID. | ||
|
||
* `instances` - Indicates the list of DCS instances. | ||
The [Instance](#DcsInstance_Instance) structure is documented below. | ||
|
||
<a name="DcsInstance_Instance"></a> | ||
The `Instance` block supports: | ||
|
||
* `id` - Indicates the ID of the instance. | ||
|
||
* `name` - Indicates the name of an instance. | ||
|
||
* `engine` - Indicates a cache engine. | ||
|
||
* `engine_version` - Indicates the version of a cache engine. | ||
|
||
* `capacity` - Indicates the cache capacity. Unit: GB. | ||
|
||
* `flavor` - Indicates the flavor of the cache instance. | ||
|
||
* `availability_zones` - Specifies the code of the AZ where the cache node resides. | ||
|
||
* `vpc_id` - Indicates the ID of VPC which the instance belongs to. | ||
|
||
* `vpc_name` - Indicates the name of VPC which the instance belongs to. | ||
|
||
* `subnet_id` - Indicates the ID of subnet which the instance belongs to. | ||
|
||
* `subnet_name` - Indicates the name of subnet which the instance belongs to. | ||
|
||
* `security_group_id` - Indicates the ID of the security group which the instance belongs to. | ||
|
||
* `security_group_name` - Indicates the name of security group which the instance belongs to. | ||
|
||
* `enterprise_project_id` - Indicates the enterprise project id of the dcs instance. | ||
|
||
* `description` - Indicates the description of an instance. | ||
|
||
* `private_ip` - Indicates the IP address of the DCS instance. | ||
|
||
* `maintain_begin` - Indicates the time at which the maintenance time window starts. | ||
|
||
* `maintain_end` - Indicates the time at which the maintenance time window ends. | ||
|
||
* `port` - Indicates the port of the cache instance. | ||
|
||
* `status` - Indicates the cache instance status. | ||
|
||
* `used_memory` - Indicates the size of the used memory. Unit: MB. | ||
|
||
* `max_memory` - Indicates the total memory size. Unit: MB. | ||
|
||
* `domain_name` - Indicates the domain name of the instance. | ||
|
||
* `access_user` - Indicates the username used for accessing a DCS Memcached instance. | ||
|
||
* `order_id` - Indicates the ID of the order that created the instance. | ||
|
||
* `tags` - Indicates The key/value pairs to associate with the DCS instance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
subcategory: "Distributed Cache Service (DCS)" | ||
--- | ||
|
||
# flexibleengine_dcs_backup_v1 | ||
|
||
Manages a DCS backup resource within FlexibleEngine. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "dcs_instance_id" {} | ||
resource "flexibleengine_dcs_backup_v1" "test"{ | ||
instance_id = var.dcs_instance_id | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `region` - (Optional, String, ForceNew) Specifies the region in which to create the resource. | ||
If omitted, the provider-level region will be used. Changing this parameter will create a new resource. | ||
|
||
* `instance_id` - (Required, String, ForceNew) Specifies the ID of the DCS instance. | ||
|
||
Changing this parameter will create a new resource. | ||
|
||
* `description` - (Optional, String, ForceNew) Specifies the description of DCS instance backup. | ||
|
||
Changing this parameter will create a new resource. | ||
|
||
* `backup_format` - (Optional, String, ForceNew) Specifies the format of the DCS instance backup. | ||
Value options: **aof**, **rdb**. Default to rdb. | ||
|
||
Changing this parameter will create a new resource. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The resource ID. | ||
|
||
* `name` - Indicates the backup name. | ||
|
||
* `size` - Indicates the size of the backup file (byte). | ||
|
||
* `type` - Indicates the backup type. Valid value: | ||
+ **manual**: indicates manual backup. | ||
+ **auto**: indicates automatic backup. | ||
|
||
* `begin_time` - Indicates the time when the backup task is created. The format is yyyy-mm-dd hh:mm:ss. | ||
The value is in UTC format. | ||
|
||
* `end_time` - Indicates the time at which DCS instance backup is completed. The format is yyyy-mm-dd hh:mm:ss. | ||
The value is in UTC format. | ||
|
||
* `status` - Indicates the backup status. Valid value: | ||
+ **waiting**: The task is waiting to begin. | ||
+ **backuping**: DCS instance backup is in progress. | ||
+ **succeed**: DCS instance backup succeeded. | ||
+ **failed**: DCS instance backup failed. | ||
+ **expired**: The backup file has expired. | ||
+ **deleted**: The backup file has been deleted manually. | ||
|
||
* `is_support_restore` - Indicates whether restoration is supported. Value Options: **TRUE**, **FALSE**. | ||
|
||
## Timeouts | ||
|
||
This resource provides the following timeouts configuration options: | ||
|
||
* `create` - Default is 30 minutes. | ||
* `delete` - Default is 10 minutes. | ||
|
||
## Import | ||
|
||
The DCS backup can be imported using the DCS instance ID and backup ID separated by a slash, e.g.: | ||
|
||
```bash | ||
terraform import flexibleengine_dcs_backup_v1.test <instance_id>/<backup_id> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
flexibleengine/acceptance/data_source_flexibleengine_dcs_flavors_v1_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package acceptance | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
||
"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" | ||
) | ||
|
||
func TestAccDataSourceDcsFlavorsV2_basic(t *testing.T) { | ||
dataSourceName := "data.flexibleengine_dcs_flavors_v1.flavors" | ||
dc := acceptance.InitDataSourceCheck(dataSourceName) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ProviderFactories: TestAccProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDcsFlavorsV2_conf(), | ||
Check: resource.ComposeTestCheckFunc( | ||
dc.CheckResourceExists(), | ||
resource.TestCheckResourceAttrSet(dataSourceName, "flavors.#"), | ||
resource.TestCheckResourceAttr(dataSourceName, "flavors.0.engine", "redis"), | ||
resource.TestCheckResourceAttr(dataSourceName, "flavors.0.capacity", "0.125"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDcsFlavorsV2_conf() string { | ||
return ` | ||
data "flexibleengine_dcs_flavors_v1" "flavors" { | ||
engine = "Redis" | ||
capacity = 0.125 | ||
} | ||
` | ||
} |
Oops, something went wrong.