From 936d63ccfa4a9710185b711ee3dfbd2c7e6dc077 Mon Sep 17 00:00:00 2001 From: wangzepeng666 Date: Mon, 11 Sep 2023 10:31:54 +0800 Subject: [PATCH] docs(dcs): fix docs issues. --- docs/data-sources/dcs_az_v1.md | 8 +-- docs/data-sources/dcs_maintainwindow_v1.md | 10 ++-- docs/data-sources/dcs_product_v1.md | 2 +- docs/resources/dcs_instance_v1.md | 51 +++++++++++-------- ...resource_flexibleengine_dcs_instance_v1.go | 5 ++ 5 files changed, 44 insertions(+), 32 deletions(-) diff --git a/docs/data-sources/dcs_az_v1.md b/docs/data-sources/dcs_az_v1.md index 96fbb1c8c..03e67d0b1 100644 --- a/docs/data-sources/dcs_az_v1.md +++ b/docs/data-sources/dcs_az_v1.md @@ -21,13 +21,13 @@ data "flexibleengine_dcs_az_v1" "az1" { ## Argument Reference -* `name` - (Optional) Indicates the name of an AZ. +* `name` - (Optional, String) Indicates the name of an AZ. -* `code` - (Optional) Indicates the code of an AZ. +* `code` - (Optional, String) Indicates the code of an AZ. -* `port` - (Optional) Indicates the port number of an AZ. +* `port` - (Optional, String) Indicates the port number of an AZ. -## Attributes Reference +## Attribute Reference `id` is set to the ID of the found az. In addition, the following attributes are exported: diff --git a/docs/data-sources/dcs_maintainwindow_v1.md b/docs/data-sources/dcs_maintainwindow_v1.md index 362a9228e..2371ed811 100644 --- a/docs/data-sources/dcs_maintainwindow_v1.md +++ b/docs/data-sources/dcs_maintainwindow_v1.md @@ -18,15 +18,15 @@ data "flexibleengine_dcs_maintainwindow_v1" "maintainwindow1" { ## Argument Reference -* `default` - (Optional) Specifies whether a maintenance time window is set to the default time segment. +* `default` - (Optional, Bool) Specifies whether a maintenance time window is set to the default time segment. -* `seq` - (Optional) Specifies the sequential number of a maintenance time window. +* `seq` - (Optional, Int) Specifies the sequential number of a maintenance time window. -* `begin` - (Optional) Specifies the time at which a maintenance time window starts. +* `begin` - (Optional, String) Specifies the time at which a maintenance time window starts. -* `end` - (Optional) Specifies the time at which a maintenance time window ends. +* `end` - (Optional, String) Specifies the time at which a maintenance time window ends. -## Attributes Reference +## Attribute Reference `id` is set to the ID of the found maintainwindow. In addition, the following attributes are exported: diff --git a/docs/data-sources/dcs_product_v1.md b/docs/data-sources/dcs_product_v1.md index 7b31a4e32..d0b5e6d3e 100644 --- a/docs/data-sources/dcs_product_v1.md +++ b/docs/data-sources/dcs_product_v1.md @@ -84,7 +84,7 @@ data "flexibleengine_dcs_product_v1" "product6" { * `spec_code` - (Optional, String) Specifies the DCS instance specification code. You can log in to the DCS console, click *Buy DCS Instance*, and find the corresponding instance specification. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: diff --git a/docs/resources/dcs_instance_v1.md b/docs/resources/dcs_instance_v1.md index 7f2004d28..a06962e8f 100644 --- a/docs/resources/dcs_instance_v1.md +++ b/docs/resources/dcs_instance_v1.md @@ -116,46 +116,46 @@ resource "flexibleengine_dcs_instance_v1" "instance_1" { The following arguments are supported: -* `name` - (Required) Indicates the name of an instance. An instance name starts with a letter, +* `name` - (Required, String) Indicates the name of an instance. An instance name starts with a letter, consists of 4 to 64 characters, and supports only letters, digits, and hyphens (-). -* `description` - (Optional) Indicates the description of an instance. It is a character +* `description` - (Optional, String) Indicates the description of an instance. It is a character string containing not more than 1024 characters. -* `engine` - (Required) Indicates a cache engine. Valid values are *Redis* and *Memcached*. +* `engine` - (Required, String, ForceNew) Indicates a cache engine. Valid values are *Redis* and *Memcached*. Changing this creates a new instance. -* `engine_version` - (Optional) Indicates the version of a cache engine. +* `engine_version` - (Optional, String, ForceNew) Indicates the version of a cache engine. This parameter is only supported and **mandatory** for *Redis* engine. Changing this creates a new instance. -* `capacity` - (Required) Indicates the Cache capacity. Unit: GB. +* `capacity` - (Required, Float, ForceNew) Indicates the Cache capacity. Unit: GB. For a DCS Redis or Memcached instance in single-node or master/standby mode, the cache capacity can be 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, or 64 GB. For a DCS Redis instance in cluster mode, the cache capacity can be 64, 128, 256, 512, or 1024 GB. Changing this creates a new instance. -* `access_user` - (Optional) Username used for accessing a DCS instance after password +* `access_user` - (Optional, String, ForceNew) Username used for accessing a DCS instance after password authentication. A username starts with a letter, consists of 1 to 64 characters, and supports only letters, digits, and hyphens (-). Changing this creates a new instance. -* `password` - (Required) Password of a DCS instance. +* `password` - (Required, String, ForceNew) Password of a DCS instance. The password of a DCS Redis instance must meet the following complexity requirements: Changing this creates a new instance. -* `vpc_id` - (Required) Specifies the id of the VPC. Changing this creates a new instance. +* `vpc_id` - (Required, String, ForceNew) Specifies the id of the VPC. Changing this creates a new instance. -* `network_id` - (Required) Specifies the ID of the VPC subnet. Changing this creates a new instance. +* `network_id` - (Required, String, ForceNew) Specifies the ID of the VPC subnet. Changing this creates a new instance. -* `security_group_id` - (Optional) Specifies the id of the security group which the instance belongs to. +* `security_group_id` - (Optional, String) Specifies the id of the security group which the instance belongs to. This parameter is only supported and **mandatory** for Memcached and Redis 3.0 versions. -* `available_zones` - (Required) IDs or Names of the AZs where cache nodes reside. For details +* `available_zones` - (Required, List, ForceNew) IDs or Names of the AZs where cache nodes reside. For details on how to query AZs, see Querying AZ Information. Changing this creates a new instance. -* `product_id` - (Optional) Product ID used to differentiate DCS instance types. +* `product_id` - (Optional, String, ForceNew) Product ID used to differentiate DCS instance types. + For **Redis 4.0/5.0** instance, please use [flexibleengine_dcs_product_v1](https://registry.terraform.io/providers/FlexibleEngineCloud/flexibleengine/latest/docs/data-sources/dcs_product_v1) to get the ID of an available product. @@ -166,11 +166,11 @@ The following arguments are supported: Changing this creates a new instance. -* `port` - (Optional) Port customization, which is supported only by Redis 4.0 and Redis 5.0 instances and not by - Redis 3.0 and Memcached instances. The values ranges from **1** to **65535**. The default value is **6379**. +* `port` - (Optional, Int, ForceNew) Port customization, which is supported only by Redis 4.0 and Redis 5.0 instances + and not by Redis 3.0 and Memcached instances. The values ranges from **1** to **65535**. The default value is **6379**. Changing this creates a new instance. -* `maintain_begin` - (Optional) Indicates the time at which a maintenance time window starts. +* `maintain_begin` - (Optional, String) Indicates the time at which a maintenance time window starts. Format: HH:mm:ss. The start time and end time of a maintenance time window must indicate the time segment of a supported maintenance time window. For details, see section Querying Maintenance Time Windows. @@ -179,7 +179,7 @@ The following arguments are supported: is left blank, parameter maintain_end is also blank. In this case, the system automatically allocates the default start time 02:00. -* `maintain_end` - (Optional) Indicates the time at which a maintenance time window ends. +* `maintain_end` - (Optional, String) Indicates the time at which a maintenance time window ends. Format: HH:mm:ss. The start time and end time of a maintenance time window must indicate the time segment of a supported maintenance time window. For details, see section Querying Maintenance Time Windows. @@ -189,24 +189,24 @@ The following arguments are supported: blank, parameter maintain_begin is also blank. In this case, the system automatically allocates the default end time 06:00. -* `save_days` - (Optional) Retention time. Unit: day. Range: 1–7. +* `save_days` - (Optional, Int, ForceNew) Retention time. Unit: day. Range: 1–7. Changing this creates a new instance. -* `backup_type` - (Optional) Backup type. Options: +* `backup_type` - (Optional, String, ForceNew) Backup type. Options: auto: automatic backup. manual: manual backup. Changing this creates a new instance. -* `begin_at` - (Optional) Time at which backup starts. "00:00-01:00" indicates that backup +* `begin_at` - (Optional, String, ForceNew) Time at which backup starts. "00:00-01:00" indicates that backup starts at 00:00:00. Changing this creates a new instance. -* `period_type` - (Optional) Interval at which backup is performed. Currently, only weekly +* `period_type` - (Optional, String, ForceNew) Interval at which backup is performed. Currently, only weekly backup is supported. Changing this creates a new instance. -* `backup_at` - (Optional) Day in a week on which backup starts. Range: 1–7. Where: 1 +* `backup_at` - (Optional, List, ForceNew) Day in a week on which backup starts. Range: 1–7. Where: 1 indicates Monday; 7 indicates Sunday. Changing this creates a new instance. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: @@ -226,6 +226,13 @@ In addition to all arguments above, the following attributes are exported: * `used_memory` - Size of the used memory. Unit: MB. * `user_id` - Indicates a user ID. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 20 minutes. +* `delete` - Default is 15 minutes. + ## Import DCS instances can be imported using the `id`, e.g. diff --git a/flexibleengine/resource_flexibleengine_dcs_instance_v1.go b/flexibleengine/resource_flexibleengine_dcs_instance_v1.go index 02db2960d..1e62f2792 100644 --- a/flexibleengine/resource_flexibleengine_dcs_instance_v1.go +++ b/flexibleengine/resource_flexibleengine_dcs_instance_v1.go @@ -182,6 +182,10 @@ func resourceDcsInstanceV1() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "user_id": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -372,6 +376,7 @@ func resourceDcsInstancesV1Read(d *schema.ResourceData, meta interface{}) error d.Set("maintain_end", v.MaintainEnd) d.Set("access_user", v.AccessUser) d.Set("available_zones", v.AvailableZones) + d.Set("user_id", v.UserID) // set capacity by Capacity and CapacityMinor var capacity float64 = float64(v.Capacity)