From 9d39cd2b52fe62c2016157371f9b100ed67f4d2f Mon Sep 17 00:00:00 2001 From: wangzepeng <65212374+Zippo-Wang@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:56:47 +0800 Subject: [PATCH 1/6] docs(waf): fix docs issues (#1026) --- docs/data-sources/waf_dedicated_instances.md | 15 +++---- docs/resources/waf_certificate.md | 12 +++++- docs/resources/waf_dedicated_certificate.md | 9 ++++- docs/resources/waf_dedicated_domain.md | 30 ++++++++++---- docs/resources/waf_dedicated_instance.md | 10 ++--- docs/resources/waf_dedicated_policy.md | 20 +++++++--- docs/resources/waf_domain.md | 22 +++++++--- docs/resources/waf_policy.md | 42 +++++++++++++------- docs/resources/waf_rule_cc_protection.md | 9 +++-- 9 files changed, 117 insertions(+), 52 deletions(-) diff --git a/docs/data-sources/waf_dedicated_instances.md b/docs/data-sources/waf_dedicated_instances.md index 1d332f3ae..107554c4f 100644 --- a/docs/data-sources/waf_dedicated_instances.md +++ b/docs/data-sources/waf_dedicated_instances.md @@ -27,12 +27,18 @@ The following arguments are supported: * `name` - (Optional, String) The name of WAF dedicated instance. -## Attributes Reference +* `enterprise_project_id` - (Optional, String) Specifies the enterprise project id of the WAF dedicated instance. + +## Attribute Reference + +In addition to all arguments above, the following attributes are exported: * `id` - The data source ID in UUID format. -The following attributes are exported: +* `instances` - An array of available WAF dedicated instances. The [instances](#waf_instances) object structure is + documented below. + The `instances` block supports: * `id` - The id of WAF dedicated instance. @@ -41,11 +47,6 @@ The `instances` block supports: * `available_zone` - The available zone names for the WAF dedicated instances. -* `specification_code` - The specification code of instance. - Different specifications have different throughput. Values are: - + `waf.instance.professional` - The professional edition, throughput: 100 Mbit/s; QPS: 2,000 (Reference only). - +`waf.instance.enterprise` - The enterprise edition, throughput: 500 Mbit/s; QPS: 10,000 (Reference only). - * `cpu_architecture` - The ECS cpu architecture of WAF dedicated instance. * `ecs_flavor` - The flavor of the ECS used by the WAF instance. diff --git a/docs/resources/waf_certificate.md b/docs/resources/waf_certificate.md index 6603af6db..19c8949fa 100644 --- a/docs/resources/waf_certificate.md +++ b/docs/resources/waf_certificate.md @@ -37,6 +37,9 @@ EOT The following arguments are supported: +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the certificate resource. + If omitted, the provider-level region will be used. Changing this will create a new certificate resource. + * `name` - (Required, String) Specifies the certificate name. The maximum length is 256 characters. Only digits, letters, underscores(`_`), and hyphens(`-`) are allowed. @@ -44,7 +47,7 @@ The following arguments are supported: * `private_key` - (Required, String, ForceNew) Specifies the private key. Changing this creates a new certificate. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: @@ -52,6 +55,13 @@ In addition to all arguments above, the following attributes are exported: * `expiration` - Indicates the time when the certificate expires. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import Certificates can be imported using the `id`, e.g. diff --git a/docs/resources/waf_dedicated_certificate.md b/docs/resources/waf_dedicated_certificate.md index 62e785179..4d2aa6006 100644 --- a/docs/resources/waf_dedicated_certificate.md +++ b/docs/resources/waf_dedicated_certificate.md @@ -48,7 +48,7 @@ The following arguments are supported: * `private_key` - (Required, String, ForceNew) Specifies the private key. Changing this creates a new certificate. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: @@ -56,6 +56,13 @@ In addition to all arguments above, the following attributes are exported: * `expiration` - Indicates the time when the certificate expires. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import Certificates can be imported using the `id`, e.g. diff --git a/docs/resources/waf_dedicated_domain.md b/docs/resources/waf_dedicated_domain.md index 4184fe8a1..f392e5418 100644 --- a/docs/resources/waf_dedicated_domain.md +++ b/docs/resources/waf_dedicated_domain.md @@ -60,14 +60,14 @@ resource "flexibleengine_waf_dedicated_domain" "domain_1" { The following arguments are supported: -* `region` - (Optional, String, ForceNew) The region in which to create the dedicated mode domain resource. If omitted, - the provider-level region will be used. Changing this setting will push a new domain. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the dedicated mode domain resource. + If omitted, the provider-level region will be used. Changing this will create a new dedicated mode domain resource. * `domain` - (Required, String, ForceNew) Specifies the domain name to be protected. For example, `www.example.com` or `*.example.com`. Changing this creates a new domain. * `server` - (Required, List, ForceNew) The server configuration list of the domain. A maximum of 80 can be configured. - The object structure is documented below. + The [server](#waf_server) object structure is documented below. * `certificate_id` - (Optional, String) Specifies the certificate ID. This parameter is mandatory when `client_protocol` is set to HTTPS. @@ -87,6 +87,24 @@ The following arguments are supported: * `protect_status` - (Optional, Int) The protection status of domain, `0`: suspended, `1`: enabled. Default value is `1`. +* `tls` - (Optional, String) Specifies the minimum required TLS version. The options include `TLS v1.0`, `TLS v1.1`, + `TLS v1.2`. + +* `cipher` - (Optional, String) Specifies the cipher suite of domain. The options include `cipher_1`, `cipher_2`, + `cipher_3`, `cipher_4`, `cipher_default`. + +* `pci_3ds` - (Optional, Bool) Specifies the status of the PCI 3DS compliance certification check. The options + include `true` and `false`. This parameter must be used together with tls and cipher. + + -> **NOTE:** Tls must be set to TLS v1.2, and cipher must be set to cipher_2. The PCI 3DS compliance certification + check cannot be disabled after being enabled. + +* `pci_dss` - (Optional, Bool) Specifies the status of the PCI DSS compliance certification check. The options + include `true` and `false`. This parameter must be used together with tls and cipher. + + -> **NOTE:** Tls must be set to TLS v1.2, and cipher must be set to cipher_2. + + The `server` block supports: * `client_protocol` - (Required, String, ForceNew) Protocol type of the client. The options include `HTTP` and `HTTPS`. @@ -106,7 +124,7 @@ The `server` block supports: * `port` - (Required, Int, ForceNew) Port number used by the web server. The value ranges from 0 to 65535. Changing this creates a new service. -## Attributes Reference +## Attribute Reference The following attributes are exported: @@ -120,10 +138,6 @@ The following attributes are exported: * `protocol` - The protocol type of the client. The options are `HTTP` and `HTTPS`. -* `tls` - The TLS configuration of domain. - -* `cihper` - The cipher suite of domain. - * `compliance_certification` - The compliance certifications of the domain, values are: + `pci_dss` - The status of domain PCI DSS, `true`: enabled, `false`: disabled. + `pci_3ds` - The status of domain PCI 3DS, `true`: enabled, `false`: disabled. diff --git a/docs/resources/waf_dedicated_instance.md b/docs/resources/waf_dedicated_instance.md index 22f3cfbc0..58b83e96a 100644 --- a/docs/resources/waf_dedicated_instance.md +++ b/docs/resources/waf_dedicated_instance.md @@ -49,8 +49,8 @@ resource "flexibleengine_waf_dedicated_instance" "instance_1" { The following arguments are supported: -* `region` - (Optional, String, ForceNew) The region in which to create the WAF dedicated instance. If omitted, the - provider-level region will be used. Changing this setting will create a new instance. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the WAF dedicated instance resource. + If omitted, the provider-level region will be used. Changing this will create a new WAF dedicated instance resource. * `name` - (Required, String) The name of WAF dedicated instance. Duplicate names are allowed, we suggest to keeping the name unique. @@ -84,7 +84,7 @@ The following arguments are supported: * `group_id` - (Optional, String, ForceNew) The instance group ID used by the WAF dedicated instance in ELB mode. Changing this will create a new instance. -## Attributes Reference +## Attribute Reference The following attributes are exported: @@ -109,8 +109,8 @@ The following attributes are exported: This resource provides the following timeouts configuration options: -* `create` - Default is 30 minute. -* `delete` - Default is 20 minute. +* `create` - Default is 30 minutes. +* `delete` - Default is 20 minutes. ## Import diff --git a/docs/resources/waf_dedicated_policy.md b/docs/resources/waf_dedicated_policy.md index fdf3ce5ac..939bbb61e 100644 --- a/docs/resources/waf_dedicated_policy.md +++ b/docs/resources/waf_dedicated_policy.md @@ -22,8 +22,8 @@ resource "flexibleengine_waf_dedicated_policy" "policy_1" { The following arguments are supported: -* `region` - (Optional, String, ForceNew) The region in which to create the WAF policy resource. If omitted, the - provider-level region will be used. Changing this setting will push a new certificate. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the WAF policy resource. + If omitted, the provider-level region will be used. Changing this will create a new WAF policy resource. * `name` - (Required, String) Specifies the policy name. The maximum length is 256 characters. Only digits, letters, underscores(_), and hyphens(-) are allowed. @@ -38,7 +38,7 @@ The following arguments are supported: + `2`: medium + `3`: high -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: @@ -46,12 +46,13 @@ In addition to all arguments above, the following attributes are exported: * `full_detection` - The detection mode in Precise Protection. + `true`: full detection, Full detection finishes all threat detections before blocking requests that meet Precise - Protection specified conditions. + Protection specified conditions. + `false`: instant detection. Instant detection immediately ends threat detection after blocking a request that - meets Precise Protection specified conditions. + meets Precise Protection specified conditions. -* `options` - The protection switches. The options object structure is documented below. +* `options` - The protection switches. The [options](#waf_options) object structure is documented below. + The `options` block supports: * `basic_web_protection` - Indicates whether Basic Web Protection is enabled. @@ -82,6 +83,13 @@ The `options` block supports: * `web_tamper_protection` - Indicates whether Web Tamper Protection is enabled. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import Policies can be imported using the `id`, e.g. diff --git a/docs/resources/waf_domain.md b/docs/resources/waf_domain.md index ffa8cb756..26c714632 100644 --- a/docs/resources/waf_domain.md +++ b/docs/resources/waf_domain.md @@ -52,10 +52,14 @@ resource "flexibleengine_waf_domain" "domain_1" { The following arguments are supported: -* `domain` - (Required, String, ForceNew) Specifies the domain name to be protected. For example, `www.example.com` or `*.example.com`. - Changing this creates a new domain. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the domain resource. + If omitted, the provider-level region will be used. Changing this will create a new domain resource. -* `server` - (Required, List) Specifies an array of origin web servers. The object structure is documented below. +* `domain` - (Required, String, ForceNew) Specifies the domain name to be protected. For example, `www.example.com` + or `*.example.com`. Changing this creates a new domain. + +* `server` - (Required, List) Specifies an array of origin web servers. The [server](#waf_server) object structure is + documented below. * `certificate_id` - (Optional, String) Specifies the certificate ID. This parameter is mandatory when `client_protocol` is set to HTTPS. @@ -63,7 +67,7 @@ The following arguments are supported: * `policy_id` - (Optional, String, ForceNew) Specifies the policy ID associated with the domain. If not specified, a new policy will be created automatically. Changing this create a new domain. -* `keep_proxy` - (Optional, Bool) Specifies whether to retain the policy when deleting a domain name. Defaults to true. +* `keep_policy` - (Optional, Bool) Specifies whether to retain the policy when deleting a domain name. Defaults to true. * `proxy` - (Optional, Bool) Specifies whether a proxy is configured. @@ -78,6 +82,7 @@ The following arguments are supported: + If `sip_header_name` is *akamai*, the value is ["True-Client-IP"]. + If `sip_header_name` is *custom*, you can customize a value. + The `server` block supports: * `client_protocol` - (Required, String) Protocol type of the client. The options are *HTTP* and *HTTPS*. @@ -90,7 +95,7 @@ The `server` block supports: * `port` - (Required, Int) Port number used by the web server. The value ranges from 0 to 65535, for example, 8080. -## Attributes Reference +## Attribute Reference The following attributes are exported: @@ -110,6 +115,13 @@ The following attributes are exported: * `protocol` - The protocol type of the client. The options are HTTP, HTTPS, and HTTP&HTTPS. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import Domains can be imported using the `id`, e.g. diff --git a/docs/resources/waf_policy.md b/docs/resources/waf_policy.md index 28aadb359..ad61306a2 100644 --- a/docs/resources/waf_policy.md +++ b/docs/resources/waf_policy.md @@ -20,6 +20,9 @@ resource "flexibleengine_waf_policy" "policy_1" { The following arguments are supported: +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the WAF policy resource. + If omitted, the provider-level region will be used. Changing this will create a new WAF policy resource. + * `name` - (Required, String) Specifies the policy name. The maximum length is 256 characters. Only digits, letters, underscores(_), and hyphens(-) are allowed. @@ -40,42 +43,51 @@ The following arguments are supported: * `domains` - (Optional, List) An array of domain IDs. -* `protection_status` - (Optional, Object) Specifies the protection switches. The object structure is documented below. +* `protection_status` - (Optional, List) Specifies the protection switches. The [protection_status](#waf_protection_status) + object structure is documented below. + The `protection_status` block supports: -* `basic_web_protection` - Specifies whether Basic Web Protection is enabled. +* `basic_web_protection` - (Optional, Bool) Specifies whether Basic Web Protection is enabled. -* `general_check` - Specifies whether General Check in Basic Web Protection is enabled. +* `general_check` - (Optional, Bool) Specifies whether General Check in Basic Web Protection is enabled. -* `crawler_engine` - Specifies whether the Search Engine switch in Basic Web Protection is enabled. +* `crawler_engine` - (Optional, Bool) Specifies whether the Search Engine switch in Basic Web Protection is enabled. -* `crawler_scanner` - Specifies whether the Scanner switch in Basic Web Protection is enabled. +* `crawler_scanner` - (Optional, Bool) Specifies whether the Scanner switch in Basic Web Protection is enabled. -* `crawler_script` - Specifies whether the Script Tool switch in Basic Web Protection is enabled. +* `crawler_script` - (Optional, Bool) Specifies whether the Script Tool switch in Basic Web Protection is enabled. -* `crawler_other` - Specifies whether detection of other crawlers in Basic Web Protection is enabled. +* `crawler_other` - (Optional, Bool) Specifies whether detection of other crawlers in Basic Web Protection is enabled. -* `webshell` - Specifies whether webshell detection in Basic Web Protection is enabled. +* `webshell` - (Optional, Bool) Specifies whether webshell detection in Basic Web Protection is enabled. -* `cc_protection` - Specifies whether CC Attack Protection is enabled. +* `cc_protection` - (Optional, Bool) Specifies whether CC Attack Protection is enabled. -* `precise_protection` - Specifies whether Precise Protection is enabled. +* `precise_protection` - (Optional, Bool) Specifies whether Precise Protection is enabled. -* `blacklist` - Specifies whether Blacklist and Whitelist is enabled. +* `blacklist` - (Optional, Bool) Specifies whether Blacklist and Whitelist is enabled. -* `data_masking` - Specifies whether Data Masking is enabled. +* `data_masking` - (Optional, Bool) Specifies whether Data Masking is enabled. -* `false_alarm_masking` - Specifies whether False Alarm Masking is enabled. +* `false_alarm_masking` - (Optional, Bool) Specifies whether False Alarm Masking is enabled. -* `web_tamper_protection` - Specifies whether Web Tamper Protection is enabled. +* `web_tamper_protection` - (Optional, Bool) Specifies whether Web Tamper Protection is enabled. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The policy ID in UUID format. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import Policies can be imported using the `id`, e.g. diff --git a/docs/resources/waf_rule_cc_protection.md b/docs/resources/waf_rule_cc_protection.md index dd1cd7621..b3c8c5e31 100644 --- a/docs/resources/waf_rule_cc_protection.md +++ b/docs/resources/waf_rule_cc_protection.md @@ -64,12 +64,13 @@ The following arguments are supported: * `block_time` - (Optional, Int) Specifies the lock duration. The value ranges from 0 seconds to 2^32 seconds. -* `block_page_type` - (Optional, String) Specifies the type of the returned page. - The options are `application/json`, `text/html`, and `text/xml`. +* `block_page_type` - (Optional, String, ForceNew) Specifies the type of the returned page. + The options are `application/json`, `text/html`, and `text/xml`. Changing this will create a new resource. -* `block_page_content` - (Optional, String) Specifies the content of the returned page. +* `block_page_content` - (Optional, String, ForceNew) Specifies the content of the returned page. Changing this will + create a new resource. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: From 807574d374f42bb8b3a2bcbcc9328563b0ac9dfb Mon Sep 17 00:00:00 2001 From: wangzepeng <65212374+Zippo-Wang@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:58:48 +0800 Subject: [PATCH 2/6] docs(sfs): fix docs issues. (#1030) --- docs/data-sources/sfs_file_system_v2.md | 21 ++--- docs/data-sources/sfs_turbos.md | 17 ++-- docs/resources/sfs_access_rule_v2.md | 37 +++++---- docs/resources/sfs_file_system_v2.md | 81 ++++++++++++------- docs/resources/sfs_turbo.md | 9 ++- ...a_source_flexibleengine_sfs_turbos_test.go | 25 +++++- .../resource_flexibleengine_sfs_turbo_test.go | 15 ++-- 7 files changed, 131 insertions(+), 74 deletions(-) diff --git a/docs/data-sources/sfs_file_system_v2.md b/docs/data-sources/sfs_file_system_v2.md index b4807d908..c6266865c 100644 --- a/docs/data-sources/sfs_file_system_v2.md +++ b/docs/data-sources/sfs_file_system_v2.md @@ -21,25 +21,30 @@ data "flexibleengine_sfs_file_system_v2" "shared_file" The following arguments are supported: -* `name` - (Optional) The name of the shared file system. +* `region` - (Optional, String) The region in which to query the data source. If omitted, the provider-level region + will be used. -* `id` - (Optional) The UUID of the shared file system. +* `name` - (Optional, String) The name of the shared file system. -* `status` - (Optional) The status of the shared file system. +* `id` - (Optional, String) The UUID of the shared file system. -## Attributes Reference +* `status` - (Optional, String) The status of the shared file system. -The following attributes are exported: +## Attribute Reference + +In addition to all arguments above, the following attributes are exported: * `availability_zone` - The availability zone name. +* `description` - The description of the shared file system. + +* `project_id` - The project ID of the operating user. + * `size` - The size (GB) of the shared file system. * `share_type` - The storage service type for the shared file system, such as high-performance storage (composed of SSDs) or large-capacity storage (composed of SATA disks). -* `status` - The status of the shared file system. - * `host` - The host name of the shared file system. * `is_public` - The level of visibility for the shared file system. @@ -56,8 +61,6 @@ The following attributes are exported: * `access_level` - The level of the access rule. -* `access_rules_status` - The status of the share access rule. - * `access_type` - The type of the share access rule. * `access_to` - The access that the back end grants or denies. diff --git a/docs/data-sources/sfs_turbos.md b/docs/data-sources/sfs_turbos.md index dd10b93cd..453331cdc 100644 --- a/docs/data-sources/sfs_turbos.md +++ b/docs/data-sources/sfs_turbos.md @@ -20,28 +20,31 @@ data "flexibleengine_sfs_turbos" "test" { The following arguments are supported: -* `region` - (Optional, String) Specifies the region in which to obtain the SFS turbo file systems. - If omitted, the provider-level region will be used. +* `region` - (Optional, String) The region in which to query the SFS turbo file systems. If omitted, the provider-level + region will be used. * `name` - (Optional, String) Specifies the name of the SFS turbo file system. * `size` - (Optional, Int) Specifies the capacity of the SFS turbo file system, in GB. - The value ranges from `500` to `32,768`, and must be large than `10,240` for an enhanced file system. + The value ranges from `500` to `32,768`, and must be larger than `10,240` for an enhanced file system. * `share_proto` - (Optional, String) Specifies the protocol of the SFS turbo file system. The valid value is **NFS**. * `share_type` - (Optional, String) Specifies the type of the SFS turbo file system. The valid values are **STANDARD** and **PERFORMANCE**. -## Attributes Reference +* `enterprise_project_id` - (Optional, String) Specifies the enterprise project id of the SFS turbo file systems + resource. + +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The data source ID. -* `turbos` - The list of the SFS turbo file systems. The [object](#turbo) structure is documented below. +* `turbos` - The list of the SFS turbo file systems. The [turbos](#sfs_turbo) object structure is documented below. - + The `turbos` block supports: * `id` - The resource ID of the SFS turbo file system. @@ -71,3 +74,5 @@ The `turbos` block supports: * `subnet_id` - The ID of the VPC Subnet to which the SFS turbo belongs. * `security_group_id` - The ID of the security group to which the SFS turbo belongs. + +* `enterprise_project_id` - The enterprise project id to which the SFS turbo belongs. diff --git a/docs/resources/sfs_access_rule_v2.md b/docs/resources/sfs_access_rule_v2.md index a95f4a6c9..962490e2f 100644 --- a/docs/resources/sfs_access_rule_v2.md +++ b/docs/resources/sfs_access_rule_v2.md @@ -58,26 +58,28 @@ resource "flexibleengine_sfs_access_rule_v2" "rule_1" { The following arguments are supported: -* `sfs_id` - (Required) Specifies the UUID of the shared file system. Changing this will create a new access rule. +* `sfs_id` - (Required, String, ForceNew) Specifies the UUID of the shared file system. + Changing this will create a new access rule. -* `access_level` - (Optional) Specifies the access level of the shared file system. Possible values are *ro* (read-only) - and *rw* (read-write). The default value is *rw* (read/write). Changing this will create a new access rule. +* `access_level` - (Optional String, ForceNew) Specifies the access level of the shared file system. Possible values + are *ro* (read-only and *rw* (read-write). The default value is *rw* (read/write). + Changing this will create a new access rule. -* `access_type` - (Optional) Specifies the type of the share access rule. The default value is *cert*. - Changing this will create a new access rule. +* `access_type` - (Optional String, ForceNew) Specifies the type of the share access rule. The default value is *cert*. + Changing this will create a new access rule. -* `access_to` - (Required) Specifies the value that defines the access rule. The value contains 1 to 255 characters. - Changing this will create a new access rule. The value varies according to the scenario: - + Set the VPC ID in VPC authorization scenarios. - + Set this parameter in IP address authorization scenario. +* `access_to` - (Required String, ForceNew) Specifies the value that defines the access rule. The value contains 1 to + 255 characters. Changing this will create a new access rule. The value varies according to the scenario: + + Set the VPC ID in VPC authorization scenarios. + + Set this parameter in IP address authorization scenario. - - For an NFS shared file system, the value in the format of *VPC_ID#IP_address#priority#user_permission*. - For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#100#all_squash,root_squash. + - For an NFS shared file system, the value in the format of *VPC_ID#IP_address#priority#user_permission*. + For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#100#all_squash,root_squash. - - For a CIFS shared file system, the value in the format of *VPC_ID#IP_address#priority*. - For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#0. + - For a CIFS shared file system, the value in the format of *VPC_ID#IP_address#priority*. + For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#0. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: @@ -85,6 +87,13 @@ In addition to all arguments above, the following attributes are exported: * `status` - The status of the share access rule. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import SFS access rule can be imported by specifying the SFS ID and access rule ID separated by a slash, e.g.: diff --git a/docs/resources/sfs_file_system_v2.md b/docs/resources/sfs_file_system_v2.md index 5e088addc..67cbddd0b 100644 --- a/docs/resources/sfs_file_system_v2.md +++ b/docs/resources/sfs_file_system_v2.md @@ -67,43 +67,48 @@ resource "flexibleengine_sfs_file_system_v2" "share-file" { The following arguments are supported: -* `size` - (Required) The size (GB) of the shared file system. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the sfs file system resource. + If omitted, the provider-level region will be used. Changing this will create a new sfs file system resource. -* `share_proto` - (Optional) The protocol for sharing file systems. The default value is NFS. +* `size` - (Required, Int) The size (GB) of the shared file system. -* `name` - (Optional) The name of the shared file system. +* `share_proto` - (Optional, String) The protocol for sharing file systems. The default value is NFS. -* `description` - (Optional) Describes the shared file system. +* `name` - (Optional, String) The name of the shared file system. -* `is_public` - (Optional) The level of visibility for the shared file system. +* `description` - (Optional, String) Describes the shared file system. -* `metadata` - (Optional) Metadata key and value pairs as a dictionary of strings. - The supported metadata keys are "#sfs_crypt_key_id", "#sfs_crypt_domain_id" and "#sfs_crypt_alias", - and the keys should be exist at the same time to enable the data encryption function. - Changing this will create a new resource. +* `is_public` - (Optional, Bool, ForceNew) The level of visibility for the shared file system. Changing this will + create a new resource. -* `availability_zone` - (Optional) The availability zone name. Changing this parameter will create a new resource. +* `metadata` - (Optional, Map, ForceNew) Metadata key and value pairs as a dictionary of strings. + The supported metadata keys are "#sfs_crypt_key_id", "#sfs_crypt_domain_id" and "#sfs_crypt_alias", + and the keys should be existed at the same time to enable the data encryption function. + Changing this will create a new resource. -* `access_level` - (Optional) Specifies the access level of the shared file system. Possible values are *ro* (read-only) - and *rw* (read-write). The default value is *rw* (read/write). Changing this will create a new access rule. +* `availability_zone` - (Optional, String, ForceNew) The availability zone name. Changing this parameter will create + a new resource. -* `access_type` - (Optional) Specifies the type of the share access rule. The default value is *cert*. - Changing this will create a new access rule. +* `access_level` - (Optional, String) Specifies the access level of the shared file system. Possible values are *ro* + (read-only) and *rw* (read-write). The default value is *rw* (read/write). Changing this will create a new access rule. -* `access_to` - (Optional) Specifies the value that defines the access rule. The value contains 1 to 255 characters. - Changing this will create a new access rule. The value varies according to the scenario: - + Set the VPC ID in VPC authorization scenarios. - + Set this parameter in IP address authorization scenario. +* `access_type` - (Optional, String) Specifies the type of the share access rule. The default value is *cert*. + Changing this will create a new access rule. - - For an NFS shared file system, the value in the format of *VPC_ID#IP_address#priority#user_permission*. - For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#100#all_squash,root_squash. +* `access_to` - (Optional, String) Specifies the value that defines the access rule. The value contains 1 to 255 + characters. Changing this will create a new access rule. The value varies according to the scenario: + + Set the VPC ID in VPC authorization scenarios. + + Set this parameter in IP address authorization scenario. - - For a CIFS shared file system, the value in the format of *VPC_ID#IP_address#priority*. - For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#0. + - For an NFS shared file system, the value in the format of *VPC_ID#IP_address#priority#user_permission*. + For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#100#all_squash,root_squash. + + - For a CIFS shared file system, the value in the format of *VPC_ID#IP_address#priority*. + For example, 0157b53f-4974-4e80-91c9-098532bcaf00#2.2.2.2/16#0. -> **NOTE:** If you want to create more access rules, please using [flexibleengine_sfs_access_rule_v2](https://www.terraform.io/docs/providers/flexibleengine/r/sfs_access_rule_v2.html). -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: @@ -117,14 +122,30 @@ In addition to all arguments above, the following attributes are exported: * `share_access_id` - The UUID of the share access rule. -* `access_rules_status` - The status of the share access rule. +* `access_rule_status` - The status of the share access rule. + +* `access_rules` - All access rules of the shared file system. The [access_rules](#sfs_access_rules) object structure + is documented below. + + +The `access_rules` block supports: + +* `access_rule_id` - The UUID of the share access rule. + +* `access_level` - The access level of the shared file system + +* `access_type` - The type of the share access rule. + +* `access_to` - The value that defines the access rule. + +* `status` - The status of the share access rule. + +## Timeouts + +This resource provides the following timeouts configuration options: -* `access_rules` - All access rules of the shared file system. The object includes the following: - + `access_rule_id` - The UUID of the share access rule. - + `access_level` - The access level of the shared file system - + `access_type` - The type of the share access rule. - + `access_to` - The value that defines the access rule. - + `status` - The status of the share access rule. +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. ## Import diff --git a/docs/resources/sfs_turbo.md b/docs/resources/sfs_turbo.md index b0502b04f..78eb3150e 100644 --- a/docs/resources/sfs_turbo.md +++ b/docs/resources/sfs_turbo.md @@ -65,6 +65,9 @@ The following arguments are supported: * `security_group_id` - (Required, String, ForceNew) Specifies the security group ID. Changing this will create a new resource. +* `enterprise_project_id` - (Optional, String, ForceNew) Specifies the enterprise project id of the resource. + Changing this will create a new resource. + * `enhanced` - (Optional, Bool, ForceNew) Specifies whether the file system is enhanced or not. Changing this will create a new resource. @@ -78,19 +81,17 @@ SFS Turbo will create two private IP addresses and one virtual IP address under normal use, SFS Turbo will enable the inbound rules for ports *111*, *445*, *2049*, *2051*, *2052*, and *20048* in the security group you specified. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: * `id` - The UUID of the SFS Turbo file system. -* `region` - The region of the SFS Turbo file system. - * `status` - The status of the SFS Turbo file system. * `version` - The version ID of the SFS Turbo file system. -* `export_location` - Tthe mount point of the SFS Turbo file system. +* `export_location` - The mount point of the SFS Turbo file system. * `available_capacity` - The available capacity of the SFS Turbo file system in the unit of GB. diff --git a/flexibleengine/acceptance/data_source_flexibleengine_sfs_turbos_test.go b/flexibleengine/acceptance/data_source_flexibleengine_sfs_turbos_test.go index 5219d0f3b..828779d64 100644 --- a/flexibleengine/acceptance/data_source_flexibleengine_sfs_turbos_test.go +++ b/flexibleengine/acceptance/data_source_flexibleengine_sfs_turbos_test.go @@ -14,6 +14,7 @@ func TestAccTurbosDataSource_basic(t *testing.T) { dcByName = acceptance.InitDataSourceCheck("data.flexibleengine_sfs_turbos.by_name") dcBySize = acceptance.InitDataSourceCheck("data.flexibleengine_sfs_turbos.by_size") dcByShareType = acceptance.InitDataSourceCheck("data.flexibleengine_sfs_turbos.by_share_type") + dcByEpsID = acceptance.InitDataSourceCheck("data.flexibleengine_sfs_turbos.by_enterprise_project") ) resource.ParallelTest(t, resource.TestCase{ @@ -29,6 +30,8 @@ func TestAccTurbosDataSource_basic(t *testing.T) { resource.TestCheckOutput("size_query_result_validation", "true"), dcByShareType.CheckResourceExists(), resource.TestCheckOutput("share_type_query_result_validation", "true"), + dcByEpsID.CheckResourceExists(), + resource.TestCheckOutput("enterprise_project_query_result_validation", "true"), ), }, }, @@ -77,10 +80,11 @@ resource "flexibleengine_sfs_turbo" "test" { security_group_id = flexibleengine_networking_secgroup_v2.test.id availability_zone = data.flexibleengine_availability_zones.test.names[0] - name = "%[1]s-${count.index}" - size = var.turbo_configuration[count.index]["size"] - share_proto = "NFS" - share_type = var.turbo_configuration[count.index]["share_type"] + name = "%[1]s-${count.index}" + size = var.turbo_configuration[count.index]["size"] + share_proto = "NFS" + share_type = var.turbo_configuration[count.index]["share_type"] + enterprise_project_id = "0" } data "flexibleengine_sfs_turbos" "by_name" { @@ -101,6 +105,12 @@ data "flexibleengine_sfs_turbos" "by_share_type" { share_type = var.turbo_configuration[1]["share_type"] } +data "flexibleengine_sfs_turbos" "by_enterprise_project" { + depends_on = [flexibleengine_sfs_turbo.test] + + enterprise_project_id = "0" +} + output "name_query_result_validation" { value = contains(data.flexibleengine_sfs_turbos.by_name.turbos[*].id, flexibleengine_sfs_turbo.test[0].id) && !contains(data.flexibleengine_sfs_turbos.by_name.turbos[*].id, @@ -121,5 +131,12 @@ output "share_type_query_result_validation" { flexibleengine_sfs_turbo.test[0].id) && !contains(data.flexibleengine_sfs_turbos.by_share_type.turbos[*].id, flexibleengine_sfs_turbo.test[2].id) } + +output "enterprise_project_query_result_validation" { + value = contains(data.flexibleengine_sfs_turbos.by_enterprise_project.turbos[*].id, + flexibleengine_sfs_turbo.test[1].id) && !contains(data.flexibleengine_sfs_turbos.by_enterprise_project.turbos[*].enterprise_project_id, + flexibleengine_sfs_turbo.test[0].id) && !contains(data.flexibleengine_sfs_turbos.by_enterprise_project.turbos[*].enterprise_project_id, + flexibleengine_sfs_turbo.test[2].id) +} `, rName) } diff --git a/flexibleengine/acceptance/resource_flexibleengine_sfs_turbo_test.go b/flexibleengine/acceptance/resource_flexibleengine_sfs_turbo_test.go index 1fe24b4db..dbbc46e22 100644 --- a/flexibleengine/acceptance/resource_flexibleengine_sfs_turbo_test.go +++ b/flexibleengine/acceptance/resource_flexibleengine_sfs_turbo_test.go @@ -164,13 +164,14 @@ func testAccSFSTurbo_basic(suffix string) string { data "flexibleengine_availability_zones" "myaz" {} resource "flexibleengine_sfs_turbo" "sfs-turbo1" { - name = "sfs-turbo-acc-%s" - size = 500 - share_proto = "NFS" - vpc_id = flexibleengine_vpc_v1.test.id - subnet_id = flexibleengine_vpc_subnet_v1.test.id - security_group_id = flexibleengine_networking_secgroup_v2.secgroup.id - availability_zone = data.flexibleengine_availability_zones.myaz.names[0] + name = "sfs-turbo-acc-%s" + size = 500 + share_proto = "NFS" + vpc_id = flexibleengine_vpc_v1.test.id + subnet_id = flexibleengine_vpc_subnet_v1.test.id + security_group_id = flexibleengine_networking_secgroup_v2.secgroup.id + availability_zone = data.flexibleengine_availability_zones.myaz.names[0] + enterprise_project_id = "0" tags = { foo = "bar" From 4602770d9d90a6b9dc55237567c70ee124d4c8ab Mon Sep 17 00:00:00 2001 From: wangzepeng <65212374+Zippo-Wang@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:59:49 +0800 Subject: [PATCH 3/6] docs(rts): fix docs issues. (#1031) --- docs/data-sources/rts_software_config_v1.md | 13 +++++---- docs/data-sources/rts_stack_resource_v1.md | 13 +++++---- docs/data-sources/rts_stack_v1.md | 7 +++-- docs/resources/rts_software_config_v1.md | 30 ++++++++++++++++----- docs/resources/rts_stack_v1.md | 26 +++++++++++------- 5 files changed, 60 insertions(+), 29 deletions(-) diff --git a/docs/data-sources/rts_software_config_v1.md b/docs/data-sources/rts_software_config_v1.md index 22f6621e1..5e1ce7502 100644 --- a/docs/data-sources/rts_software_config_v1.md +++ b/docs/data-sources/rts_software_config_v1.md @@ -26,19 +26,22 @@ resource "flexibleengine_rts_software_deployment_v1" "mydeployment" { The following arguments are supported: -* `id` - (Optional) The id of the software configuration. +* `region` - (Optional, String) The region in which to query the data source. If omitted, the provider-level region + will be used. -* `name` - (Optional) The name of the software configuration. +* `id` - (Optional, String) The id of the software configuration. -## Attributes Reference +* `name` - (Optional, String) The name of the software configuration. + +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `group` - The namespace that groups this software configuration by when it is delivered to a server. -* `inputs` - A list of software configuration inputs. +* `input_values` - A list of software configuration inputs. -* `outputs` - A list of software configuration outputs. +* `output_values` - A list of software configuration outputs. * `config` - The software configuration code. diff --git a/docs/data-sources/rts_stack_resource_v1.md b/docs/data-sources/rts_stack_resource_v1.md index 0c1eb329b..d446dab23 100644 --- a/docs/data-sources/rts_stack_resource_v1.md +++ b/docs/data-sources/rts_stack_resource_v1.md @@ -22,15 +22,18 @@ data "flexibleengine_rts_stack_resource_v1" "stackresource" { The following arguments are supported: -* `stack_name` - (Required) The unique stack name. +* `region` - (Optional, String) The region in which to query the data source. If omitted, the provider-level region + will be used. -* `resource_name` - (Optional) The name of a resource in the stack. +* `stack_name` - (Required, String) The unique stack name. -* `physical_resource_id` - (Optional) The physical resource ID. +* `resource_name` - (Optional, String) The name of a resource in the stack. -* `resource_type` - (Optional) The resource type. +* `physical_resource_id` - (Optional, String) The physical resource ID. -## Attributes Reference +* `resource_type` - (Optional, String) The resource type. + +## Attribute Reference In addition to all arguments above, the following attributes are exported: diff --git a/docs/data-sources/rts_stack_v1.md b/docs/data-sources/rts_stack_v1.md index bdcd193c9..ee24e3a3d 100644 --- a/docs/data-sources/rts_stack_v1.md +++ b/docs/data-sources/rts_stack_v1.md @@ -20,9 +20,12 @@ data "flexibleengine_rts_stack_v1" "mystack" { The following arguments are supported: -* `name` - (Required) The name of the stack. +* `region` - (Optional, String) The region in which to query the data source. If omitted, the provider-level region + will be used. -## Attributes Reference +* `name` - (Required, String) The name of the stack. + +## Attribute Reference In addition to all arguments above, the following attributes are exported: diff --git a/docs/resources/rts_software_config_v1.md b/docs/resources/rts_software_config_v1.md index 6901c3a64..2a349547b 100644 --- a/docs/resources/rts_software_config_v1.md +++ b/docs/resources/rts_software_config_v1.md @@ -22,24 +22,40 @@ resource "flexibleengine_rts_software_config_v1" "myconfig" { The following arguments are supported: -* `name` - (Required) The name of the software configuration. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the RTS software resource. + If omitted, the provider-level region will be used. Changing this will create a new RTS software resource. -* `group` - (Optional) The namespace that groups this software configuration by when it is delivered to a server. +* `name` - (Required, String, ForceNew) The name of the software configuration. Changing this will create a new RTS + software resource. -* `input_values` - (Optional) A list of software configuration inputs. +* `group` - (Optional, String, ForceNew) The namespace that groups this software configuration by when it is delivered + to a server. Changing this will create a new RTS software resource. -* `output_values` - (Optional) A list of software configuration outputs. +* `input_values` - (Optional, List, ForceNew) A list of software configuration inputs. Changing this will create a new + RTS software resource. -* `config` - (Optional) The software configuration code. +* `output_values` - (Optional, List, ForceNew) A list of software configuration outputs. Changing this will create a + new RTS software resource. -* `options` - (Optional) The software configuration options. +* `config` - (Optional, String, ForceNew) The software configuration code. Changing this will create a new RTS software + resource. -## Attributes Reference +* `options` - (Optional, Map, ForceNew) The software configuration options. Changing this will create a new RTS software + resource. + +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The id of the software config. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 3 minutes. + ## Import Software Config can be imported using the `config id`, e.g. diff --git a/docs/resources/rts_stack_v1.md b/docs/resources/rts_stack_v1.md index 2bdd79bcd..9c6ad9bc3 100644 --- a/docs/resources/rts_stack_v1.md +++ b/docs/resources/rts_stack_v1.md @@ -78,25 +78,31 @@ STACK The following arguments are supported: -* `name` - (Required) A unique name for the stack. The value must meet the regular expression rule (`^[a-zA-Z][a-zA-Z0-9_.-]{0,254}$`). +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the RTS stack resource. + If omitted, the provider-level region will be used. Changing this will create a new RTS stack resource. + +* `name` - (Required, String, ForceNew) Specifies the name of the resource stack. + The valid length is limited from can contain 1 to 64, only letters, digits and hyphens (-) are allowed. + The name must start with a lowercase letter and end with a lowercase letter or digit. Changing this creates a new stack. -* `template_body` - (Optional; Required if `template_url` is empty) Structure containing the template body. - The template content must use the yaml syntax. +* `template_body` - (Optional, String) Structure containing the template body. The template content must use the yaml + syntax. It is **Required** if `template_url` is empty. -* `template_url` - (Optional; Required if `template_body` is empty) Location of a file containing the template body. +* `template_url` - (Optional, String) Location of a file containing the template body. It is **Required** if + `template_body` is empty -* `environment` - (Optional) Tthe environment information about the stack. +* `environment` - (Optional, String) The environment information about the stack. -* `files` - (Optional) Files used in the environment. +* `files` - (Optional, Map) Files used in the environment. -* `parameters` - (Optional) A list of Parameter structures that specify input parameters for the stack. +* `parameters` - (Optional, Map) A list of Parameter structures that specify input parameters for the stack. -* `disable_rollback` - (Optional) Set to true to disable rollback of the stack if stack creation failed. +* `disable_rollback` - (Optional, Bool) Set to true to disable rollback of the stack if stack creation failed. -* `timeout_mins` - (Optional) Specifies the timeout duration. +* `timeout_mins` - (Optional, Int) Specifies the timeout duration. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: From cfca97cf4cbd7b55b6265f9630fb6ac679bf9dc1 Mon Sep 17 00:00:00 2001 From: wangzepeng <65212374+Zippo-Wang@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:01:10 +0800 Subject: [PATCH 4/6] docs(sdrs): fix docs issues. (#1032) --- docs/data-sources/sdrs_domain_v1.md | 5 ++- docs/resources/sdrs_drill_v1.md | 21 ++++++----- docs/resources/sdrs_protectedinstance_v1.md | 35 ++++++++++++------- docs/resources/sdrs_protectiongroup_v1.md | 31 ++++++++++------ docs/resources/sdrs_replication_attach_v1.md | 20 ++++++++--- docs/resources/sdrs_replication_pair_v1.md | 19 ++++++---- .../resource_flexibleengine_sdrs_drill.go | 1 - ...flexibleengine_sdrs_replication_pair_v1.go | 4 --- 8 files changed, 86 insertions(+), 50 deletions(-) diff --git a/docs/data-sources/sdrs_domain_v1.md b/docs/data-sources/sdrs_domain_v1.md index f20394b67..6630c8bc8 100644 --- a/docs/data-sources/sdrs_domain_v1.md +++ b/docs/data-sources/sdrs_domain_v1.md @@ -18,12 +18,11 @@ data "flexibleengine_sdrs_domain_v1" "dom_1" { ## Argument Reference -* `name` - (Optional) Specifies the name of an active-active domain. Currently only support SDRS_HypeDomain01. +* `name` - (Optional, String) Specifies the name of an active-active domain. Currently only support SDRS_HypeDomain01. -## Attributes Reference +## Attribute Reference `id` is set to the ID of the active-active domain. In addition, the following attributes are exported: -* `name` - See Argument Reference above. * `description` - Specifies the description of an active-active domain. diff --git a/docs/resources/sdrs_drill_v1.md b/docs/resources/sdrs_drill_v1.md index b1ca04982..8d044dc9c 100644 --- a/docs/resources/sdrs_drill_v1.md +++ b/docs/resources/sdrs_drill_v1.md @@ -46,25 +46,30 @@ resource "flexibleengine_sdrs_drill_v1" "drill_1" { The following arguments are supported: -* `name` - (Required) The name of a DR drill. The name can contain a maximum of 64 bytes. +* `name` - (Required, String) The name of a DR drill. The name can contain a maximum of 64 bytes. The value can contain only letters (a to z and A to Z), digits (0 to 9), decimal points (.), underscores (_), and hyphens (-). -* `group_id` - (Required) Specifies the ID of a protection group. Changing this creates a new drill. +* `group_id` - (Required, String, ForceNew) Specifies the ID of a protection group. Changing this creates a new drill. -* `drill_vpc_id` - (Required) Specifies the ID used for a DR drill. Changing this creates a new drill. +* `drill_vpc_id` - (Required, String, ForceNew) Specifies the ID used for a DR drill. Changing this creates a new drill. -## Attributes Reference +## Attribute Reference -The following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - ID of a DR drill. -* `name` - See Argument Reference above. -* `group_id` - See Argument Reference above. -* `drill_vpc_id` - See Argument Reference above. + * `status` - The status of a DR drill. For details, see [DR Drill Status](https://docs.prod-cloud-ocb.orange-business.com/en-us/api/sdrs/en-us_topic_0126152933.html). +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import DR drill can be imported using the `id`, e.g. diff --git a/docs/resources/sdrs_protectedinstance_v1.md b/docs/resources/sdrs_protectedinstance_v1.md index ce632d783..715b908bd 100644 --- a/docs/resources/sdrs_protectedinstance_v1.md +++ b/docs/resources/sdrs_protectedinstance_v1.md @@ -43,32 +43,41 @@ resource "flexibleengine_sdrs_protectedinstance_v1" "instance_1" { The following arguments are supported: -* `name` - (Required) The name of a protected instance. +* `name` - (Required, String) The name of a protected instance. -* `description` - (Optional) The description of a protected instance. Changing this creates a new instance. +* `description` - (Optional, String, ForceNew) The description of a protected instance. Changing this creates a new + instance. -* `group_id` - (Required) Specifies the ID of the protection group where a protected instance is added. - Changing this creates a new instance. +* `group_id` - (Required, String, ForceNew) Specifies the ID of the protection group where a protected instance is + added. Changing this creates a new instance. -* `server_id` - (Required) Specifies the ID of the source server. Changing this creates a new instance. +* `server_id` - (Required, String, ForceNew) Specifies the ID of the source server. Changing this creates a new instance. -* `cluster_id` - (Optional) Specifies the ID of a storage pool. Changing this creates a new instance. +* `cluster_id` - (Optional, String, ForceNew) Specifies the ID of a storage pool. Changing this creates a new instance. -* `primary_subnet_id` - (Optional) Specifies the `ipv4_subnet_id` or `ipv6_subnet_id` of the +* `primary_subnet_id` - (Optional, String, ForceNew) Specifies the `ipv4_subnet_id` or `ipv6_subnet_id` of the VPC Subnet of the primary NIC on the target server. Changing this creates a new instance. -* `primary_ip_address` - (Optional) Specifies the IP address of the primary NIC on the target server. +* `primary_ip_address` - (Optional, String, ForceNew) Specifies the IP address of the primary NIC on the target server. Changing this creates a new instance. -* `delete_target_server` - (Optional) Specifies whether to delete the target server. The default value is false. - Changing this creates a new instance. +* `delete_target_server` - (Optional, Bool, ForceNew) Specifies whether to delete the target server. The default + value is false. Changing this creates a new instance. -* `delete_target_eip` - (Optional) Specifies whether to delete the EIP of the target server. The default value is false. - Changing this creates a new instance. +* `delete_target_eip` - (Optional, Bool, ForceNew) Specifies whether to delete the EIP of the target server. + The default value is false. Changing this creates a new instance. -## Attributes Reference +## Attribute Reference The following attributes are exported: * `id` - ID of the protected instance. + * `target_server` - ID of the target server. + +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. diff --git a/docs/resources/sdrs_protectiongroup_v1.md b/docs/resources/sdrs_protectiongroup_v1.md index b6ccf21da..7ee06607e 100644 --- a/docs/resources/sdrs_protectiongroup_v1.md +++ b/docs/resources/sdrs_protectiongroup_v1.md @@ -36,30 +36,41 @@ resource "flexibleengine_sdrs_protectiongroup_v1" "group_1" { The following arguments are supported: -* `name` - (Required) The name of a protection group. +* `name` - (Required, String) The name of a protection group. -* `description` - (Optional) The description of a protection group. Changing this creates a new group. +* `description` - (Optional, String, ForceNew) The description of a protection group. Changing this creates a new group. -* `source_availability_zone` - (Required) Specifies the source AZ of a protection group. Changing this creates a new group. - -* `target_availability_zone` - (Required) Specifies the target AZ of a protection group. Changing this creates a new group. +* `source_availability_zone` - (Required, String, ForceNew) Specifies the source AZ of a protection group. + Changing this creates a new group. -* `domain_id` - (Required) Specifies the ID of an active-active domain. Changing this creates a new group. +* `target_availability_zone` - (Required, String, ForceNew) Specifies the target AZ of a protection group. + Changing this creates a new group. -* `source_vpc_id` - (Required) Specifies the ID of the source VPC. Changing this creates a new group. +* `domain_id` - (Required, String, ForceNew) Specifies the ID of an active-active domain. + Changing this creates a new group. -* `dr_type` - (Optional) Specifies the deployment model. The default value is migration indicating migration within a VPC. +* `source_vpc_id` - (Required, String, ForceNew) Specifies the ID of the source VPC. Changing this creates a new group. -* `enable` - (Optional) Enable protection or not. It can only be set to true when there's replication pairs within +* `dr_type` - (Optional, String, ForceNew) Specifies the deployment model. The default value is migration indicating + migration within a VPC. Changing this creates a new group. + +* `enable` - (Optional, Bool) Enable protection or not. It can only be set to true when there's replication pairs within the protection group. -## Attributes Reference +## Attribute Reference The following attributes are exported: * `id` - ID of the protection group. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import Protection groups can be imported using the `id`, e.g. diff --git a/docs/resources/sdrs_replication_attach_v1.md b/docs/resources/sdrs_replication_attach_v1.md index ab98c836c..3e1dfaf9d 100644 --- a/docs/resources/sdrs_replication_attach_v1.md +++ b/docs/resources/sdrs_replication_attach_v1.md @@ -55,16 +55,26 @@ resource "flexibleengine_sdrs_replication_attach_v1" "attach_1" { The following arguments are supported: -* `instance_id` - (Required) Specifies the ID of a protected instance. Changing this creates a new replication attach. +* `instance_id` - (Required, String, ForceNew) Specifies the ID of a protected instance. + Changing this creates a new replication attach. -* `replication_id` - (Required) Specifies the ID of a replication pair. Changing this creates a new replication attach. +* `replication_id` - (Required, String, ForceNew) Specifies the ID of a replication pair. + Changing this creates a new replication attach. -* `device` - (Required) Specifies the device name, eg. /dev/vdb. Changing this creates a new replication attach. +* `device` - (Required, String, ForceNew) Specifies the device name, eg. /dev/vdb. + Changing this creates a new replication attach. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The resource ID in format of :. -* `status` - The status of the SDRS replication attch resource. +* `status` - The status of the SDRS replication attach resource. + +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. diff --git a/docs/resources/sdrs_replication_pair_v1.md b/docs/resources/sdrs_replication_pair_v1.md index 6a60a17ef..455bdb936 100644 --- a/docs/resources/sdrs_replication_pair_v1.md +++ b/docs/resources/sdrs_replication_pair_v1.md @@ -41,20 +41,20 @@ resource "flexibleengine_sdrs_replication_pair_v1" "replication_1" { The following arguments are supported: -* `name` - (Required) The name of a replication pair. The name can contain a maximum of 64 bytes. +* `name` - (Required, String) The name of a replication pair. The name can contain a maximum of 64 bytes. The value can contain only letters (a to z and A to Z), digits (0 to 9), decimal points (.), underscores (_), and hyphens (-). -* `description` - (Optional) The description of a replication pair. Changing this creates a new pair. +* `description` - (Optional, String, ForceNew) The description of a replication pair. Changing this creates a new pair. -* `group_id` - (Required) Specifies the ID of a protection group. Changing this creates a new pair. +* `group_id` - (Required, String, ForceNew) Specifies the ID of a protection group. Changing this creates a new pair. -* `volume_id` - (Required) Specifies the ID of a source disk. Changing this creates a new pair. +* `volume_id` - (Required, String, ForceNew) Specifies the ID of a source disk. Changing this creates a new pair. -* `delete_target_volume` - (Optional) Specifies whether to delete the target disk. +* `delete_target_volume` - (Optional, Bool) Specifies whether to delete the target disk. The default value is `false`. -## Attributes Reference +## Attribute Reference The following attributes are exported: @@ -68,6 +68,13 @@ The following attributes are exported: * `target_volume_id` - Specifies the ID of the disk in the protection availability zone. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import Replication pairs can be imported using the `id`, e.g. diff --git a/flexibleengine/resource_flexibleengine_sdrs_drill.go b/flexibleengine/resource_flexibleengine_sdrs_drill.go index 7f92fb3c4..f37218855 100644 --- a/flexibleengine/resource_flexibleengine_sdrs_drill.go +++ b/flexibleengine/resource_flexibleengine_sdrs_drill.go @@ -43,7 +43,6 @@ func resourceSdrsDrillV1() *schema.Resource { }, "status": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, diff --git a/flexibleengine/resource_flexibleengine_sdrs_replication_pair_v1.go b/flexibleengine/resource_flexibleengine_sdrs_replication_pair_v1.go index a70892220..a0c735c63 100644 --- a/flexibleengine/resource_flexibleengine_sdrs_replication_pair_v1.go +++ b/flexibleengine/resource_flexibleengine_sdrs_replication_pair_v1.go @@ -57,22 +57,18 @@ func resourceSdrsReplicationPairV1() *schema.Resource { // the following attributes are computed "replication_model": { Type: schema.TypeString, - Optional: true, Computed: true, }, "fault_level": { Type: schema.TypeString, - Optional: true, Computed: true, }, "status": { Type: schema.TypeString, - Optional: true, Computed: true, }, "target_volume_id": { Type: schema.TypeString, - Optional: true, Computed: true, }, }, From fcfb7845efe93dd1f278d5c283230d946939daf8 Mon Sep 17 00:00:00 2001 From: wangzepeng <65212374+Zippo-Wang@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:04:13 +0800 Subject: [PATCH 5/6] docs(rds): fix docs issues. (#1033) --- docs/data-sources/rds_flavors_v3.md | 15 +++- docs/resources/rds_account.md | 14 +++- docs/resources/rds_database.md | 18 ++++- docs/resources/rds_database_privilege.md | 26 +++++-- docs/resources/rds_instance_v3.md | 75 ++++++++++++------- docs/resources/rds_parametergroup_v3.md | 51 +++++++++---- docs/resources/rds_read_replica_v3.md | 69 ++++++++++------- ...esource_flexibleengine_rds_account_test.go | 53 ++++++------- ...source_flexibleengine_rds_database_test.go | 1 + ...rce_flexibleengine_rds_instance_v3_test.go | 7 ++ 10 files changed, 212 insertions(+), 117 deletions(-) diff --git a/docs/data-sources/rds_flavors_v3.md b/docs/data-sources/rds_flavors_v3.md index 013d61bba..c45858c6f 100644 --- a/docs/data-sources/rds_flavors_v3.md +++ b/docs/data-sources/rds_flavors_v3.md @@ -19,6 +19,9 @@ data "flexibleengine_rds_flavors_v3" "flavor" { ## Argument Reference +* `region` - (Optional, String) The region in which to query the data source. If omitted, the provider-level region + will be used. + * `db_type` - (Required, String) Specifies the DB engine. Value: MySQL, PostgreSQL, SQLServer. * `db_version` - (Required, String) Specifies the database version. MySQL databases support MySQL 5.6 @@ -42,21 +45,29 @@ data "flexibleengine_rds_flavors_v3" "flavor" { * `availability_zone` - (Optional, String) Specifies the availability zone which the RDS flavor belongs to. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The data source ID. -* `flavors` - Indicates the flavors information. Structure is documented below. +* `flavors` - Indicates the flavors information. The [flavors](#rds_flavors) object structure is documented below. + The `flavors` block contains: * `id` - The ID of the rds flavor. + * `name` - The name of the rds flavor. + * `vcpus` - The CPU size. + * `memory` - The memory size in GB. + * `group_type` - The performance specification. + * `instance_mode` - The mode of instance. + * `availability_zones` - The availability zones which the RDS flavor belongs to. + * `db_versions` - The Available versions of the database. diff --git a/docs/resources/rds_account.md b/docs/resources/rds_account.md index 8c9dfa5e3..39eafd3f3 100644 --- a/docs/resources/rds_account.md +++ b/docs/resources/rds_account.md @@ -24,8 +24,8 @@ resource "flexibleengine_rds_account" "test" { The following arguments are supported: -* `region` - (Optional, String, ForceNew) The region in which to create the rds account resource. If omitted, the - provider-level region will be used. Changing this creates a new resource. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the RDS account resource. + If omitted, the provider-level region will be used. Changing this will create a new RDS account resource. * `instance_id` - (Required, String, ForceNew) Specifies the rds instance id. Changing this will create a new resource. @@ -38,12 +38,20 @@ The following arguments are supported: long and contain only letters(case-sensitive), digits, and special characters(~!@#$%^*-_=+?,()&). The value must be different from name or name spelled backwards. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The resource ID of account which is formatted `/`. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `update` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import RDS account can be imported using the `instance id` and `account name`, e.g.: diff --git a/docs/resources/rds_database.md b/docs/resources/rds_database.md index 0fc898482..0c424f3c9 100644 --- a/docs/resources/rds_database.md +++ b/docs/resources/rds_database.md @@ -24,8 +24,8 @@ resource "flexibleengine_rds_database" "test" { The following arguments are supported: -* `region` - (Optional, String, ForceNew) The region in which to create the RDS database resource. If omitted, the - provider-level region will be used. Changing this creates a new resource. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the RDS database resource. + If omitted, the provider-level region will be used. Changing this will create a new RDS database resource. * `instance_id` - (Required, String, ForceNew) Specifies the RDS instance ID. Changing this will create a new resource. @@ -37,12 +37,24 @@ The following arguments are supported: * `character_set` - (Required, String, ForceNew) Specifies the character set used by the database, For example **utf8**, **gbk**, **ascii**, etc. Changing this will create a new resource. -## Attributes Reference +* `description` - (Optional, String) Specifies the database description. The value can contain **0** to **512** + characters. This parameter takes effect only for DB instances whose kernel versions are at least **5.6.51.3**, + **5.7.33.1**, or **8.0.21.4**. + +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The resource ID of database which is formatted `/`. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `update` - Default is 10 minutes. +* `delete` - Default is 10 minutes. + ## Import RDS database can be imported using the `instance id` and `database name`, e.g. diff --git a/docs/resources/rds_database_privilege.md b/docs/resources/rds_database_privilege.md index ef20edeff..b08d22daa 100644 --- a/docs/resources/rds_database_privilege.md +++ b/docs/resources/rds_database_privilege.md @@ -36,32 +36,42 @@ resource "flexibleengine_rds_database_privilege" "test" { The following arguments are supported: -* `region` - (Optional, String, ForceNew) The region in which to create the RDS database privilege resource. If omitted, - the provider-level region will be used. Changing this creates a new resource. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the RDS database privilege resource. + If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource. * `instance_id` - (Required, String, ForceNew) Specifies the RDS instance ID. Changing this will create a new resource. * `db_name` - (Required, String, ForceNew) Specifies the database name. Changing this creates a new resource. -* `users` - (Required, String, ForceNew) Specifies the account that associated with the database. This parameter supports - a maximum of 50 elements. Structure is documented below. Changing this creates a new resource. +* `users` - (Required, List, ForceNew) Specifies the account that associated with the database. This parameter supports + a maximum of 50 elements. The [users](#rds_users) object structure is documented below. + Changing this creates a new resource. + The `users` block supports: -* `name` - (Required, String, ForceNew) Specifies the username of the database account. Changing this creates a new resource. +* `name` - (Required, String) Specifies the username of the database account. -* `readonly` - (Optional, Bool, ForceNew) Specifies the read-only permission. The value can be: +* `readonly` - (Optional, Bool) Specifies the read-only permission. The value can be: + **true**: indicates the read-only permission. + **false**: indicates the read and write permission. - The default value is **false**. Changing this creates a new resource. + The default value is **false**. -## Attributes Reference +## Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The resource ID of database privilege which is formatted `/`. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 30 minutes. +* `update` - Default is 30 minutes. +* `delete` - Default is 30 minutes. + ## Import RDS database privilege can be imported using the `instance id` and `database name`, e.g. diff --git a/docs/resources/rds_instance_v3.md b/docs/resources/rds_instance_v3.md index 23c1a49c5..4f9e4c5e2 100644 --- a/docs/resources/rds_instance_v3.md +++ b/docs/resources/rds_instance_v3.md @@ -156,6 +156,9 @@ resource "flexibleengine_rds_instance_v3" "instance" { The following arguments are supported: +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the RDS instance resource. + If omitted, the provider-level region will be used. Changing this will create a new RDS instance resource. + * `name` - (Required, String) Specifies the DB instance name. The DB instance name of the same type must be unique for the same tenant. The value must be 4 to 64 characters in length and start with a letter. It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_). @@ -167,8 +170,8 @@ The following arguments are supported: * `availability_zone` - (Required, List, ForceNew) Specifies the list of AZ name. Changing this parameter will create a new resource. -* `db` - (Required, String, ForceNew) Specifies the database information. Structure is documented below. - Changing this parameter will create a new resource. +* `db` - (Required, List, ForceNew) Specifies the database information. The [db](#rds_db) object structure is + documented below. Changing this parameter will create a new resource. * `vpc_id` - (Required, String, ForceNew) Specifies the VPC ID. Changing this parameter will create a new resource. @@ -177,12 +180,13 @@ The following arguments are supported: * `security_group_id` - (Required, String) Specifies the security group which the RDS DB instance belongs to. -* `volume` - (Required, List) Specifies the volume information. Structure is documented below. +* `volume` - (Required, List) Specifies the volume information. The [volume](#rds_volume) object structure is + documented below. -* `fixed_ip` - (Optional, String, ForceNew) Specifies an intranet IP address of RDS DB instance. - Changing this parameter will create a new resource. +* `fixed_ip` - (Optional, String) Specifies an intranet IP address of RDS DB instance. -* `backup_strategy` - (Optional, List) Specifies the advanced backup policy. Structure is documented below. +* `backup_strategy` - (Optional, List) Specifies the advanced backup policy. The [backup_strategy](#rds_backup_strategy) + object structure is documented below. * `ha_replication_mode` - (Optional, String, ForceNew) Specifies the replication mode for the standby DB instance. Changing this parameter will create a new resource. @@ -204,6 +208,11 @@ The following arguments are supported: * `tags` - (Optional, Map) A mapping of tags to assign to the RDS instance. Each tag is represented by one key-value pair. +* `parameters` - (Optional, List) Specify an array of one or more parameters to be set to the RDS instance after + launched. You can check on console to see which parameters supported. The [parameters](#rds_parameters) object + structure is documented below. + + The `db` block supports: * `type` - (Required, String, ForceNew) Specifies the DB engine. Available value are *MySQL*, *PostgreSQL* and @@ -215,20 +224,19 @@ The `db` block supports: databases support 2014 SE and 2014 EE, example values: "2014_SE", "2014_EE". Changing this parameter will create a new resource. -* `password` - (Required, String, ForceNew) Specifies the database password. The value cannot be - empty and should contain 8 to 32 characters, including uppercase - and lowercase letters, digits, and the following special - characters: ~!@#%^*-_=+? You are advised to enter a strong - password to improve security, preventing security risks such as - brute force cracking. Changing this parameter will create a new resource. +* `password` - (Required, String) Specifies the database password. The value cannot be + empty and should contain 8 to 32 characters, including uppercase and lowercase letters, digits, and the following + special characters: ~!@#%^*-_=+? You are advised to enter a strong password to improve security, preventing security + risks such as brute force cracking. * `port` - (Optional, Int) Specifies the database port. + The MySQL database port ranges from 1024 to 65535 (excluding 12017 and 33071, which are occupied by the RDS system and cannot be used). The default value is 3306. + The PostgreSQL database port ranges from 2100 to 9500. The default value is 5432. + The Microsoft SQL Server database port can be 1433 or ranges from 2100 to 9500, excluding 5355 and 5985. - The default value is 1433. + The default value is 1433. + The `volume` block supports: * `size` - (Required, Int) Specifies the volume size. Its value range is from 40 GB to 4000 GB. @@ -241,9 +249,10 @@ The `volume` block supports: Changing this parameter will create a new resource. -* `disk_encryption_id` - (Optional, String) Specifies the key ID for disk encryption. +* `disk_encryption_id` - (Optional, String, ForceNew) Specifies the key ID for disk encryption. Changing this parameter will create a new resource. + The `backup_strategy` block supports: * `keep_days` - (Optional, Int) Specifies the retention days for specific backup files. The value range is from 0 to @@ -253,12 +262,19 @@ The `backup_strategy` block supports: policy. * `start_time` - (Required, String) Specifies the backup time window. Automated backups will be triggered during the - backup time window. It must be a valid value in the **hh:mm-HH:MM** - format. The current time is in the UTC format. The HH value must be 1 greater than the hh value. The values of mm and - MM must be the same and must be set to any of the following: 00, 15, 30, or 45. Example value: 08:15-09:15 23:00-00: - 00. + backup time window. It must be a valid value in the **hh:mm-HH:MM** format. The current time is in the UTC format. + The HH value must be 1 greater than the hh value. The values of mm and MM must be the same and must be set to any + of the following: 00, 15, 30, or 45. Example value: 08:15-09:15 23:00-00:00. + + +The `parameters` block supports: + +* `name` - (Required, String) Specifies the parameter name. Some of them needs the instance to be restarted + to take effect. -## Attributes Reference +* `value` - (Required, String) Specifies the parameter value. + +## Attribute Reference In addition to the arguments listed above, the following computed attributes are exported: @@ -268,18 +284,17 @@ In addition to the arguments listed above, the following computed attributes are * `created` - Indicates the creation time. -* `nodes` - Indicates the instance nodes information. Structure is documented below. +* `nodes` - Indicates the instance nodes information. The [nodes](#rds_attr_nodes) object structure is documented below. * `private_ips` - Indicates the private IP address list. It is a blank string until an ECS is created. * `public_ips` - Indicates the public IP address list. -* `db` - See Argument Reference above. The `db` block also contains: - - + `user_name` - Indicates the default user name of database. +* `db` - See Argument Reference above. The [db](#rds_attr_db) object structure is documented below. -The `nodes` block contains: + +The `nodes` block supports: * `availability_zone` - Indicates the AZ. @@ -292,12 +307,18 @@ The `nodes` block contains: * `status` - Indicates the node status. + +The `db` block supports: + +* `user_name` - Indicates the default username of database. + ## Timeouts This resource provides the following timeouts configuration options: -* `create` - Default is 30 minute. -* `update` - Default is 30 minute. +* `create` - Default is 30 minutes. +* `update` - Default is 30 minutes. +* `delete` - Default is 30 minutes. ## Import @@ -307,7 +328,7 @@ RDS instance can be imported using the `id`, e.g. terraform import flexibleengine_rds_instance_v3.instance_1 7117d38e-4c8f-4624-a505-bd96b97d024c ``` -But due to some attrubutes missing from the API response, it's required to ignore changes as below. +But due to some attributes missing from the API response, it's required to ignore changes as below. ```hcl resource "flexibleengine_rds_instance_v3" "instance_1" { diff --git a/docs/resources/rds_parametergroup_v3.md b/docs/resources/rds_parametergroup_v3.md index e899b9179..359780c74 100644 --- a/docs/resources/rds_parametergroup_v3.md +++ b/docs/resources/rds_parametergroup_v3.md @@ -32,42 +32,61 @@ resource "flexibleengine_rds_parametergroup_v3" "pg_1" { The following arguments are supported: -* `name` - (Required) The parameter group name. It contains a maximum of 64 characters. +* `name` - (Required, String) The parameter group name. It contains a maximum of 64 characters. -* `description` - (Optional) The parameter group description. It contains a maximum of 256 characters and +* `description` - (Optional, String) The parameter group description. It contains a maximum of 256 characters and cannot contain the following special characters:>!<"&'= the value is left blank by default. -* `values` - (Optional) Parameter group values key/value pairs defined by users based on the default parameter groups. +* `values` - (Optional, Map) Parameter group values key/value pairs defined by users based on the default + parameter groups. -* `datastore` - (Required) Database object. The database object structure is documented below. - Changing this creates a new parameter group. +* `datastore` - (Required, List, ForceNew) Database object. The [datastore](#rds_datastore) object structure is + documented below. Changing this creates a new parameter group. + The `datastore` block supports: -* `type` - (Required) The DB engine. Currently, MySQL, PostgreSQL, and Microsoft SQL Server are supported. +* `type` - (Required, String) The DB engine. Currently, MySQL, PostgreSQL, and Microsoft SQL Server are supported. The value is case-insensitive and can be mysql, postgresql, or sqlserver. -* `version` - (Required) Specifies the database version. +* `version` - (Required, String) Specifies the database version. + MySQL databases support MySQL 5.6 and 5.7. Example value: 5.7. + PostgreSQL databases support PostgreSQL 9.5 and 9.6. Example value: 9.5. + Microsoft SQL Server databases support 2014 SE, 2016 SE, and 2016 EE. Example value: 2014_SE. -## Attributes Reference +## Attribute Reference The following attributes are exported: * `id` - ID of the parameter group. -* `configuration_parameters` - Indicates the parameter configuration defined by users based on the default parameters groups. +* `configuration_parameters` - Indicates the parameter configuration defined by users based on the default + parameters groups. The [configuration_parameters](#rds_configuration_parameters) object structure is documented below. - + `name` - Indicates the parameter name. - + `value` - Indicates the parameter value. - + `restart_required` - Indicates whether a restart is required. - + `readonly` - Indicates whether the parameter is read-only. - + `value_range` - Indicates the parameter value range. - + `type` - Indicates the parameter type. - + `description` - Indicates the parameter description. + +The `configuration_parameters` block supports: + +* `name` - Indicates the parameter name. + +* `value` - Indicates the parameter value. + +* `restart_required` - Indicates whether a restart is required. + +* `readonly` - Indicates whether the parameter is read-only. + +* `value_range` - Indicates the parameter value range. + +* `type` - Indicates the parameter type. + +* `description` - Indicates the parameter description. + +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 10 minutes. +* `delete` - Default is 10 minutes. ## Import diff --git a/docs/resources/rds_read_replica_v3.md b/docs/resources/rds_read_replica_v3.md index f842f604f..59d342a60 100644 --- a/docs/resources/rds_read_replica_v3.md +++ b/docs/resources/rds_read_replica_v3.md @@ -68,45 +68,46 @@ resource "flexibleengine_rds_read_replica_v3" "instance_2" { The following arguments are supported: -* `name` - (Required) Specifies the DB instance name. - The DB instance name of the same type must be unique for the - same tenant. The value must be 4 to 64 characters in length - and start with a letter. It is case-sensitive and can contain - only letters, digits, hyphens (-), and underscores (_). - Changing this parameter will create a new resource. +* `region` - (Optional, String, ForceNew) Specifies the region in which to create the RDS read replica resource. + If omitted, the provider-level region will be used. Changing this will create a new RDS read replica resource. + Currently, read replicas can be created only in the same region as that of the primary DB instance. -* `flavor` - (Required) Specifies the specification code. +* `name` - (Required, String, ForceNew) Specifies the DB instance name. The DB instance name of the same type must be + unique for the same tenant. The value must be 4 to 64 characters in length and start with a letter. It is + case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_). + Changing this parameter will create a new resource. -* `replica_of_id` - (Required) Specifies the DB instance ID, which is used to - create a read replica. Changing this parameter will create a new resource. +* `flavor` - (Required, String) Specifies the specification code. -* `volume` - (Required) Specifies the volume information. Structure is documented below. - Changing this parameter will create a new resource. +* `replica_of_id` - (Required, String, ForceNew) Specifies the DB instance ID, which is used to create a read replica. + Changing this parameter will create a new resource. -* `availability_zone` - (Required) Specifies the AZ name. - Changing this parameter will create a new resource. +* `volume` - (Required, List, ForceNew) Specifies the volume information. The [volume](#rds_volume) object structure is + documented below. Changing this parameter will create a new resource. -* `tags` - (Optional) A mapping of tags to assign to the RDS read replica instance. - Each tag is represented by one key-value pair. +* `availability_zone` - (Required, String, ForceNew) Specifies the AZ name. + Changing this parameter will create a new resource. -* `region` - (Optional) The region in which to create the instance. If omitted, - the `region` argument of the provider is used. Currently, read replicas can - be created only in the same region as that of the promary DB instance. - Changing this parameter will create a new resource. +* `tags` - (Optional, Map) A mapping of tags to assign to the RDS read replica instance. + Each tag is represented by one key-value pair. + The `volume` block supports: -* `type` - (Required) Specifies the volume type. Its value can be any of the following - and is case-sensitive: - - ULTRAHIGH: indicates the SSD type. - - ULTRAHIGHPRO: indicates the ultra-high I/O. +* `type` - (Required, String, ForceNew) Specifies the volume type. Its value can be any of the following + and is case-sensitive: + - ULTRAHIGH: indicates the SSD type. + - ULTRAHIGHPRO: indicates the ultra-high I/O. - Changing this parameter will create a new resource. + Changing this parameter will create a new resource. -* `disk_encryption_id` - (Optional) Specifies the key ID for disk encryption. - Changing this parameter will create a new resource. +* `disk_encryption_id` - (Optional, String, ForceNew) Specifies the key ID for disk encryption. + Changing this parameter will create a new resource. -## Attributes Reference +* `size` - (Optional, Int) Specifies the volume size. Its value range is from **40** GB to **4000** GB. The value must + be a multiple of 10 and greater than the original size. + +## Attribute Reference In addition to the arguments listed above, the following computed attributes are exported: @@ -114,7 +115,9 @@ In addition to the arguments listed above, the following computed attributes are * `status` - Indicates the instance status. -* `db` - Indicates the database information. Structure is documented below. +* `type` - Indicates the type of the read replica instance. + +* `db` - Indicates the database information. The [db](#rds_db) object structure is documented below. * `private_ips` - Indicates the private IP address list. @@ -126,16 +129,24 @@ In addition to the arguments listed above, the following computed attributes are * `vpc_id` - Indicates the VPC ID. + The `db` block supports: * `port` - Indicates the database port information. * `type` - Indicates the DB engine. Value: MySQL, PostgreSQL, SQLServer. -* `user_name` - Indicates the default user name of database. +* `user_name` - Indicates the default username of database. * `version` - Indicates the database version. +## Timeouts + +This resource provides the following timeouts configuration options: + +* `create` - Default is 30 minutes. +* `delete` - Default is 30 minutes. + ## Import RDS instance can be imported using the `id`, e.g. diff --git a/flexibleengine/acceptance/resource_flexibleengine_rds_account_test.go b/flexibleengine/acceptance/resource_flexibleengine_rds_account_test.go index 59758c793..69ce52ddc 100644 --- a/flexibleengine/acceptance/resource_flexibleengine_rds_account_test.go +++ b/flexibleengine/acceptance/resource_flexibleengine_rds_account_test.go @@ -176,36 +176,31 @@ resource "flexibleengine_networking_secgroup_v2" "test" { name = "%[1]s" } -data "flexibleengine_rds_flavors_v3" "test" { - db_type = "MySQL" - db_version = "5.7" - instance_mode = "single" - vcpus = 2 - memory = 4 -} - resource "flexibleengine_rds_instance_v3" "test" { - name = "%[1]s" - flavor = data.flexibleengine_rds_flavors_v3.test.flavors[0].name - security_group_id = flexibleengine_networking_secgroup_v2.test.id - subnet_id = flexibleengine_vpc_subnet_v1.test.id - vpc_id = flexibleengine_vpc_v1.test.id - - availability_zone = [ - data.flexibleengine_availability_zones.test.names[0] - ] - - db { - password = "Huangwei!120521" - type = "MySQL" - version = "5.7" - port = 3306 - } - - volume { - type = "ULTRAHIGH" - size = 40 - } + name = "%[1]s" + flavor = "rds.mysql.c6.large.2.ha" + security_group_id = flexibleengine_networking_secgroup_v2.test.id + subnet_id = flexibleengine_vpc_subnet_v1.test.id + vpc_id = flexibleengine_vpc_v1.test.id + fixed_ip = "192.168.0.58" + ha_replication_mode = "semisync" + + availability_zone = [ + data.flexibleengine_availability_zones.test.names[0], + data.flexibleengine_availability_zones.test.names[1], + ] + + db { + password = "Huangwei!120521" + type = "MySQL" + version = "5.7" + port = 3306 + } + + volume { + type = "ULTRAHIGH" + size = 50 + } } `, rName) } diff --git a/flexibleengine/acceptance/resource_flexibleengine_rds_database_test.go b/flexibleengine/acceptance/resource_flexibleengine_rds_database_test.go index e8669cbe3..a8713ec3c 100644 --- a/flexibleengine/acceptance/resource_flexibleengine_rds_database_test.go +++ b/flexibleengine/acceptance/resource_flexibleengine_rds_database_test.go @@ -105,6 +105,7 @@ resource "flexibleengine_rds_database" "test" { instance_id = flexibleengine_rds_instance_v3.test.id name = "%s" character_set = "utf8" + description = "terraform script description" } `, testRdsAccount_base(rName), rName) } diff --git a/flexibleengine/acceptance/resource_flexibleengine_rds_instance_v3_test.go b/flexibleengine/acceptance/resource_flexibleengine_rds_instance_v3_test.go index 1f4ad9a67..2e1f93224 100644 --- a/flexibleengine/acceptance/resource_flexibleengine_rds_instance_v3_test.go +++ b/flexibleengine/acceptance/resource_flexibleengine_rds_instance_v3_test.go @@ -36,6 +36,8 @@ func TestAccRdsInstanceV3_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "volume.0.size", "60"), resource.TestCheckResourceAttr(resourceName, "tags.key", "value"), resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"), + resource.TestCheckResourceAttr(resourceName, "parameters.0.name", "div_precision_increment"), + resource.TestCheckResourceAttr(resourceName, "parameters.0.value", "12"), resource.TestCheckResourceAttrSet(resourceName, "fixed_ip"), ), }, @@ -171,6 +173,11 @@ resource "flexibleengine_rds_instance_v3" "instance" { keep_days = 1 } + parameters { + name = "div_precision_increment" + value = "12" + } + tags = { key = "value" foo = "bar" From c14dba577e0cf56c9c6aa682414b8753b78db4c2 Mon Sep 17 00:00:00 2001 From: wangzepeng <65212374+Zippo-Wang@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:07:07 +0800 Subject: [PATCH 6/6] feat(DLI): support global variable resource (#1034) --- docs/resources/dli_global_variable.md | 48 +++++++ ...flexibleengine_dli_global_variable_test.go | 121 ++++++++++++++++++ flexibleengine/provider.go | 19 +-- 3 files changed, 179 insertions(+), 9 deletions(-) create mode 100644 docs/resources/dli_global_variable.md create mode 100644 flexibleengine/acceptance/resource_flexibleengine_dli_global_variable_test.go diff --git a/docs/resources/dli_global_variable.md b/docs/resources/dli_global_variable.md new file mode 100644 index 000000000..d52ccacca --- /dev/null +++ b/docs/resources/dli_global_variable.md @@ -0,0 +1,48 @@ +--- +subcategory: "Data Lake Insight (DLI)" +--- + +# flexibleengine_dli_global_variable + +Manages a DLI global variable resource within FlexibleEngine. + +## Example Usage + +```hcl +resource "flexibleengine_dli_global_variable" "test" { + name = "demo" + value = "abc" +} +``` + +## 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. + +* `name` - (Required, String, ForceNew) The name of a global variable. + This parameter can contain a maximum of 128 characters, which may consist of digits, letters, and underscores (\_), + but cannot start with an underscore (\_) or contain only digits. + + Changing this parameter will create a new resource. + +* `value` - (Required, String) The value of global variable. + +* `is_sensitive` - (Optional, Bool, ForceNew) Whether to set a variable as a sensitive variable. The default value is + **false**. 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 which equals the name. + +## Import + +The global variable can be imported using the `id` which equals the name, e.g. + +```shell +terraform import flexibleengine_dli_global_variable.test demo_name +``` diff --git a/flexibleengine/acceptance/resource_flexibleengine_dli_global_variable_test.go b/flexibleengine/acceptance/resource_flexibleengine_dli_global_variable_test.go new file mode 100644 index 000000000..e69d193fa --- /dev/null +++ b/flexibleengine/acceptance/resource_flexibleengine_dli_global_variable_test.go @@ -0,0 +1,121 @@ +package acceptance + +import ( + "encoding/json" + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + "github.com/chnsz/golangsdk" + "github.com/chnsz/golangsdk/pagination" + + "github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/config" + "github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" + "github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/utils" +) + +func getGlobalVariableResourceFunc(cfg *config.Config, state *terraform.ResourceState) (interface{}, error) { + region := OS_REGION_NAME + // getGlobalVariable: Query the Global variable. + var ( + getGlobalVariableHttpUrl = "v1.0/{project_id}/variables" + getGlobalVariableProduct = "dli" + ) + getGlobalVariableClient, err := cfg.NewServiceClient(getGlobalVariableProduct, region) + if err != nil { + return nil, fmt.Errorf("error creating DLI Client: %s", err) + } + + getGlobalVariablePath := getGlobalVariableClient.Endpoint + getGlobalVariableHttpUrl + getGlobalVariablePath = strings.ReplaceAll(getGlobalVariablePath, "{project_id}", getGlobalVariableClient.ProjectID) + + getGlobalVariableResp, err := pagination.ListAllItems( + getGlobalVariableClient, + "offset", + getGlobalVariablePath, + &pagination.QueryOpts{MarkerField: ""}) + if err != nil { + return nil, fmt.Errorf("error retrieving DLI global variable: %s", err) + } + + getGlobalVariableRespJson, err := json.Marshal(getGlobalVariableResp) + if err != nil { + return nil, fmt.Errorf("error retrieving DLI global variable: %s", err) + } + var getGlobalVariableRespBody interface{} + err = json.Unmarshal(getGlobalVariableRespJson, &getGlobalVariableRespBody) + if err != nil { + return nil, fmt.Errorf("error retrieving DLI global variable: %s", err) + } + + jsonPath := fmt.Sprintf("global_vars[?var_name=='%s']|[0]", state.Primary.ID) + globalVariable := utils.PathSearch(jsonPath, getGlobalVariableRespBody, nil) + if globalVariable == nil { + return nil, golangsdk.ErrDefault404{} + } + + return globalVariable, nil +} + +func TestAccGlobalVariable_basic(t *testing.T) { + var obj interface{} + + name := acceptance.RandomAccResourceName() + rName := "flexibleengine_dli_global_variable.test" + + rc := acceptance.InitResourceCheck( + rName, + &obj, + getGlobalVariableResourceFunc, + ) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.TestAccPreCheck(t) }, + ProviderFactories: TestAccProviderFactories, + CheckDestroy: rc.CheckResourceDestroy(), + Steps: []resource.TestStep{ + { + Config: testGlobalVariable_basic(name), + Check: resource.ComposeTestCheckFunc( + rc.CheckResourceExists(), + resource.TestCheckResourceAttr(rName, "name", name), + resource.TestCheckResourceAttr(rName, "value", "abc"), + ), + }, + { + Config: testGlobalVariable_basic_update(name), + Check: resource.ComposeTestCheckFunc( + rc.CheckResourceExists(), + resource.TestCheckResourceAttr(rName, "name", name), + resource.TestCheckResourceAttr(rName, "value", "abcd"), + ), + }, + { + ResourceName: rName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testGlobalVariable_basic(name string) string { + return fmt.Sprintf(` +resource "flexibleengine_dli_global_variable" "test" { + name = "%s" + value = "abc" +} +`, name) +} + +func testGlobalVariable_basic_update(name string) string { + return fmt.Sprintf(` +resource "flexibleengine_dli_global_variable" "test" { + name = "%s" + value = "abcd" +} +`, name) +} diff --git a/flexibleengine/provider.go b/flexibleengine/provider.go index 7b666ee5f..6be2041f8 100644 --- a/flexibleengine/provider.go +++ b/flexibleengine/provider.go @@ -490,15 +490,16 @@ func Provider() *schema.Provider { "flexibleengine_dms_rocketmq_topic": dms.ResourceDmsRocketMQTopic(), "flexibleengine_dms_rocketmq_user": dms.ResourceDmsRocketMQUser(), - "flexibleengine_dli_database": dli.ResourceDliSqlDatabaseV1(), - "flexibleengine_dli_package": dli.ResourceDliPackageV2(), - "flexibleengine_dli_spark_job": dli.ResourceDliSparkJobV2(), - "flexibleengine_dli_table": dli.ResourceDliTable(), - "flexibleengine_dli_flinksql_job": dli.ResourceFlinkSqlJob(), - "flexibleengine_drs_job": drs.ResourceDrsJob(), - "flexibleengine_fgs_dependency": fgs.ResourceFgsDependency(), - "flexibleengine_fgs_function": fgs.ResourceFgsFunctionV2(), - "flexibleengine_fgs_trigger": fgs.ResourceFunctionGraphTrigger(), + "flexibleengine_dli_database": dli.ResourceDliSqlDatabaseV1(), + "flexibleengine_dli_global_variable": dli.ResourceGlobalVariable(), + "flexibleengine_dli_package": dli.ResourceDliPackageV2(), + "flexibleengine_dli_spark_job": dli.ResourceDliSparkJobV2(), + "flexibleengine_dli_table": dli.ResourceDliTable(), + "flexibleengine_dli_flinksql_job": dli.ResourceFlinkSqlJob(), + "flexibleengine_drs_job": drs.ResourceDrsJob(), + "flexibleengine_fgs_dependency": fgs.ResourceFgsDependency(), + "flexibleengine_fgs_function": fgs.ResourceFgsFunctionV2(), + "flexibleengine_fgs_trigger": fgs.ResourceFunctionGraphTrigger(), "flexibleengine_gaussdb_cassandra_instance": gaussdb.ResourceGeminiDBInstanceV3(), "flexibleengine_gaussdb_influx_instance": gaussdb.ResourceGaussDBInfluxInstanceV3(),