-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dcs): import dcs resource and add unit test and docs
- Loading branch information
1 parent
692b7b6
commit 151abe9
Showing
12 changed files
with
998 additions
and
5 deletions.
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,98 @@ | ||
--- | ||
subcategory: "Distributed Cache Service (DCS)" | ||
--- | ||
|
||
# g42cloud_dcs_instances | ||
|
||
Use this data source to get the list of DCS instances. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "g42cloud_dcs_instances" "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 [instances](#DcsInstance_Instance) structure is documented below. | ||
|
||
<a name="DcsInstance_Instance"></a> | ||
The `instances` 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. | ||
|
||
* `charging_mode` - Indicates the charging mode of the cache instance. | ||
|
||
* `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,79 @@ | ||
--- | ||
subcategory: "Distributed Cache Service (DCS)" | ||
--- | ||
|
||
# g42cloud_dcs_template_detail | ||
|
||
Use this data source to get the detail of DCS template. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "template_id" {} | ||
data "g42cloud_dcs_template_detail" "test" { | ||
template_id = var.template_id | ||
type = "sys" | ||
} | ||
``` | ||
|
||
## 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. | ||
|
||
* `type` - (Required, String) Specifies the type of the template. Value options: | ||
+ **sys**: system template. | ||
+ **user**: custom template. | ||
|
||
* `template_id` - (Required, String) Specifies the ID of the template. | ||
|
||
* `params` - (Optional, List) Specifies the list of the template params. | ||
The [params](#TemplateDetail_Param) structure is documented below. | ||
|
||
<a name="TemplateDetail_Param"></a> | ||
The `params` block supports: | ||
|
||
* `param_name` - (Optional, String) Specifies the name of the param. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The resource ID. | ||
|
||
* `name` - Indicates the name of the template. | ||
|
||
* `type` - Indicates the type of the template. The value can be **sys**, **user**. | ||
|
||
* `engine` - Indicates the cache engine. Currently, only **Redis** is supported. | ||
|
||
* `engine_version` - Indicates the cache engine version. The value can be **4.0**, **5.0**, **6.0**. | ||
|
||
* `cache_mode` - Indicates the DCS instance type. The value can be **single**, **ha**, **cluster**, **proxy**, | ||
**ha_rw_split**. | ||
|
||
* `product_type` - Indicates the product edition. The value can be **generic**, **enterprise**. | ||
|
||
* `storage_type` - Indicates the storage type. The value can be **DRAM**, **SSD**. | ||
|
||
* `description` - Indicates the description of the template. | ||
|
||
* `params` - Indicates the list of the template params. | ||
The [params](#TemplateDetail_Param) structure is documented below. | ||
|
||
<a name="TemplateDetail_Param"></a> | ||
The `params` block supports: | ||
|
||
* `param_id` - Indicates the ID of the param. | ||
|
||
* `default_value` - Indicates the default of the param. | ||
|
||
* `value_range` - Indicates the value range of the param. | ||
|
||
* `value_type` - Indicates the value type of the param. | ||
|
||
* `description` - Indicates the description of the param. | ||
|
||
* `need_restart` - Indicates whether the DCS instance need restart. |
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,77 @@ | ||
--- | ||
subcategory: "Distributed Cache Service (DCS)" | ||
--- | ||
|
||
# g42cloud_dcs_templates | ||
|
||
Use this data source to get the list of DCS templates. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "g42cloud_dcs_templates" "test" { | ||
type = "sys" | ||
name = "test_template_name" | ||
} | ||
``` | ||
|
||
## 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. | ||
|
||
* `type` - (Required, String) Specifies the type of the template. Value options: | ||
+ **sys**: system template. | ||
+ **user**: custom template. | ||
|
||
* `template_id` - (Optional, String) Specifies the ID of the template. | ||
|
||
* `name` - (Optional, String) Specifies the name of the template. | ||
|
||
* `engine` - (Optional, String) Specifies the cache engine. Value options: **Redis**. | ||
|
||
* `engine_version` - (Optional, String) Specifies the cache engine version. Value options: **4.0**, **5.0**, **6.0**. | ||
|
||
* `cache_mode` - (Optional, String) Specifies the DCS instance type. Value options: | ||
+ **single**: single-node. | ||
+ **ha**: master/standby. | ||
+ **cluster**: Redis Cluster. | ||
+ **proxy**: Proxy Cluster. | ||
+ **ha_rw_split**: read/write splitting. | ||
|
||
* `product_type` - (Optional, String) Specifies the product edition. Value options: | ||
+ **generic**: standard edition. | ||
|
||
* `storage_type` - (Optional, String) Specifies the storage type. Value options: **DRAM**. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The resource ID. | ||
|
||
* `templates` - Indicates the list of DCS templates. | ||
The [templates](#Templates_Template) structure is documented below. | ||
|
||
<a name="Templates_Template"></a> | ||
The `templates` block supports: | ||
|
||
* `template_id` - Indicates the ID of the template. | ||
|
||
* `name` - Indicates the name of the template. | ||
|
||
* `type` - Indicates the type of the template. | ||
|
||
* `engine` - Indicates the cache engine. | ||
|
||
* `engine_version` - Indicates the cache engine version. | ||
|
||
* `cache_mode` - Indicates the DCS instance type. | ||
|
||
* `product_type` - Indicates the product edition. | ||
|
||
* `storage_type` - Indicates the storage type. | ||
|
||
* `description` - Indicates the description of the template. |
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)" | ||
--- | ||
|
||
# g42cloud_dcs_backup | ||
|
||
Manages a DCS backup resource within G42Cloud. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
variable "dcs_instance_id" {} | ||
resource "g42cloud_dcs_backup" "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 g42cloud_dcs_backup.test <instance_id>/<backup_id> | ||
``` |
Oops, something went wrong.