From dc1895fadacda67ae026aa5ac10f2550f32b84ab 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] 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"