From e1a9bc41a259acc1e20bf27b4ca32146e67f702d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=93=B2=E9=93=AD?= Date: Mon, 11 Dec 2023 14:46:18 +0800 Subject: [PATCH 1/6] feat: opt nat doc --- common/common_volcengine_version.go | 2 +- .../resource_volcengine_snat_entry.go | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/common_volcengine_version.go b/common/common_volcengine_version.go index 59be38c1..2823c26f 100644 --- a/common/common_volcengine_version.go +++ b/common/common_volcengine_version.go @@ -2,5 +2,5 @@ package common const ( TerraformProviderName = "terraform-provider-volcengine" - TerraformProviderVersion = "0.0.130" + TerraformProviderVersion = "0.0.131" ) diff --git a/volcengine/nat/snat_entry/resource_volcengine_snat_entry.go b/volcengine/nat/snat_entry/resource_volcengine_snat_entry.go index d31c88a8..a9780cd1 100644 --- a/volcengine/nat/snat_entry/resource_volcengine_snat_entry.go +++ b/volcengine/nat/snat_entry/resource_volcengine_snat_entry.go @@ -2,6 +2,9 @@ package snat_entry import ( "fmt" + "reflect" + "sort" + "strings" "time" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" @@ -48,8 +51,18 @@ func ResourceVolcengineSnatEntry() *schema.Resource { Description: "The id of the subnet that is required to access the internet. Only one of `subnet_id,source_cidr` can be specified.", }, "eip_id": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if len(old) != len(new) { + return false + } + oldArr := strings.Split(old, ",") + newArr := strings.Split(new, ",") + sort.Strings(oldArr) + sort.Strings(newArr) + return reflect.DeepEqual(oldArr, newArr) + }, Description: "The id of the public ip address used by the SNAT entry.", }, "snat_entry_name": { From 4ac28be86af06792abc48a9ff266339fe36806d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=93=B2=E9=93=AD?= Date: Tue, 12 Dec 2023 15:46:31 +0800 Subject: [PATCH 2/6] feat: eip update --- example/bandwidthPackageAttachment/main.tf | 2 ++ .../data_source_volcengine_eip_addresses.go | 35 ++++++++++++++----- .../resource_volcengine_eip_address.go | 13 +++++++ .../service_volcengine_eip_address.go | 4 +++ website/docs/d/eip_addresses.html.markdown | 5 ++- ...bandwidth_package_attachment.html.markdown | 14 ++++---- website/docs/r/eip_address.html.markdown | 1 + 7 files changed, 58 insertions(+), 16 deletions(-) diff --git a/example/bandwidthPackageAttachment/main.tf b/example/bandwidthPackageAttachment/main.tf index cc7b4d8e..d402f2f5 100644 --- a/example/bandwidthPackageAttachment/main.tf +++ b/example/bandwidthPackageAttachment/main.tf @@ -5,6 +5,7 @@ resource "volcengine_eip_address" "foo" { name = "acc-eip" description = "acc-test" project_name = "default" + security_protection_types = ["AntiDDoS_Enhanced"] } resource "volcengine_bandwidth_package" "foo" { @@ -18,6 +19,7 @@ resource "volcengine_bandwidth_package" "foo" { key = "tftest" value = "tftest" } + security_protection_types = ["AntiDDoS_Enhanced"] } resource "volcengine_bandwidth_package_attachment" "foo" { diff --git a/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go b/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go index 999dc217..7d0179e0 100644 --- a/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go +++ b/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go @@ -40,16 +40,14 @@ func DataSourceVolcengineEipAddresses() *schema.Resource { Description: "A name of EIP.", }, "isp": { - Type: schema.TypeString, - Optional: true, - Description: "An ISP of EIP Address, the value can be `BGP` or `ChinaMobile` or `ChinaUnicom` or `ChinaTelecom`.", - ValidateFunc: validation.StringInSlice([]string{"BGP", "ChinaMobile", "ChinaUnicom", "ChinaTelecom"}, false), + Type: schema.TypeString, + Optional: true, + Description: "An ISP of EIP Address, the value can be `BGP` or `ChinaMobile` or `ChinaUnicom` or `ChinaTelecom`.", }, "associated_instance_type": { - Type: schema.TypeString, - Optional: true, - Description: "A type of associated instance, the value can be `Nat`, `NetworkInterface`, `ClbInstance` or `EcsInstance`.", - ValidateFunc: validation.StringInSlice([]string{"Nat", "NetworkInterface", "ClbInstance", "EcsInstance"}, false), + Type: schema.TypeString, + Optional: true, + Description: "A type of associated instance, the value can be `Nat`, `NetworkInterface`, `ClbInstance`, `AlbInstance`, `HaVip` or `EcsInstance`.", }, "associated_instance_id": { Type: schema.TypeString, @@ -62,7 +60,13 @@ func DataSourceVolcengineEipAddresses() *schema.Resource { Description: "The ProjectName of EIP.", }, "tags": ve.TagsSchema(), - + "security_protection_enabled": { + Type: schema.TypeBool, + Optional: true, + Description: "Security protection. The values are as follows: " + + "`true`: Enhanced protection type for public IP (can be added to DDoS native protection (Enterprise Edition) instance). " + + "`false`: Default protection type for public IP.", + }, "output_file": { Type: schema.TypeString, Optional: true, @@ -174,6 +178,19 @@ func DataSourceVolcengineEipAddresses() *schema.Resource { Computed: true, Description: "The ProjectName of the EIP.", }, + "security_protection_types": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "Security protection types for shared bandwidth packages. Parameter - N: Indicates the number of security protection types, currently only supports taking 1. Value: `AntiDDoS_Enhanced`.", + }, + "bandwidth_package_id": { + Type: schema.TypeString, + Computed: true, + Description: "The id of the bandwidth package.", + }, "tags": ve.TagsSchemaComputed(), }, }, diff --git a/volcengine/eip/eip_address/resource_volcengine_eip_address.go b/volcengine/eip/eip_address/resource_volcengine_eip_address.go index 383611ad..f356cbb8 100644 --- a/volcengine/eip/eip_address/resource_volcengine_eip_address.go +++ b/volcengine/eip/eip_address/resource_volcengine_eip_address.go @@ -119,6 +119,19 @@ func ResourceVolcengineEipAddress() *schema.Resource { Computed: true, Description: "The ProjectName of the EIP.", }, + "security_protection_types": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "Security protection types for public IP addresses. " + + "Parameter - N: Indicates the number of security protection types, currently only supports taking 1. Value: `AntiDDoS_Enhanced` or left blank." + + "If the value is `AntiDDoS_Enhanced`, then will create an eip with enhanced protection," + + "(can be added to DDoS native protection (enterprise version) instance). " + + "If left blank, it indicates an eip with basic protection.", + }, "tags": ve.TagsSchema(), "status": { Type: schema.TypeString, diff --git a/volcengine/eip/eip_address/service_volcengine_eip_address.go b/volcengine/eip/eip_address/service_volcengine_eip_address.go index 8517cc38..0cb057fa 100644 --- a/volcengine/eip/eip_address/service_volcengine_eip_address.go +++ b/volcengine/eip/eip_address/service_volcengine_eip_address.go @@ -189,6 +189,10 @@ func (s *VolcengineEipAddressService) CreateResource(resourceData *schema.Resour TargetField: "Tags", ConvertType: ve.ConvertListN, }, + "security_protection_types": { + TargetField: "SecurityProtectionTypes", + ConvertType: ve.ConvertWithN, + }, }, }, } diff --git a/website/docs/d/eip_addresses.html.markdown b/website/docs/d/eip_addresses.html.markdown index 2233505b..3d5d5762 100644 --- a/website/docs/d/eip_addresses.html.markdown +++ b/website/docs/d/eip_addresses.html.markdown @@ -20,13 +20,14 @@ data "volcengine_eip_addresses" "foo" { ## Argument Reference The following arguments are supported: * `associated_instance_id` - (Optional) An id of associated instance. -* `associated_instance_type` - (Optional) A type of associated instance, the value can be `Nat`, `NetworkInterface`, `ClbInstance` or `EcsInstance`. +* `associated_instance_type` - (Optional) A type of associated instance, the value can be `Nat`, `NetworkInterface`, `ClbInstance`, `AlbInstance`, `HaVip` or `EcsInstance`. * `eip_addresses` - (Optional) A list of EIP ip address that you want to query. * `ids` - (Optional) A list of EIP allocation ids. * `isp` - (Optional) An ISP of EIP Address, the value can be `BGP` or `ChinaMobile` or `ChinaUnicom` or `ChinaTelecom`. * `name` - (Optional) A name of EIP. * `output_file` - (Optional) File name where to save data source results. * `project_name` - (Optional) The ProjectName of EIP. +* `security_protection_enabled` - (Optional) Security protection. The values are as follows: `true`: Enhanced protection type for public IP (can be added to DDoS native protection (Enterprise Edition) instance). `false`: Default protection type for public IP. * `status` - (Optional) A status of EIP, the value can be `Attaching` or `Detaching` or `Attached` or `Available`. * `tags` - (Optional) Tags. @@ -40,6 +41,7 @@ In addition to all arguments above, the following attributes are exported: * `addresses` - The collection of EIP addresses. * `allocation_id` - The id of the EIP address. * `allocation_time` - The allocation time of the EIP. + * `bandwidth_package_id` - The id of the bandwidth package. * `bandwidth` - The peek bandwidth of the EIP. * `billing_type` - The billing type of the EIP. * `business_status` - The business status of the EIP. @@ -55,6 +57,7 @@ In addition to all arguments above, the following attributes are exported: * `name` - The name of the EIP. * `overdue_time` - The overdue time of the EIP. * `project_name` - The ProjectName of the EIP. + * `security_protection_types` - Security protection types for shared bandwidth packages. Parameter - N: Indicates the number of security protection types, currently only supports taking 1. Value: `AntiDDoS_Enhanced`. * `status` - The status of the EIP. * `tags` - Tags. * `key` - The Key of Tags. diff --git a/website/docs/r/bandwidth_package_attachment.html.markdown b/website/docs/r/bandwidth_package_attachment.html.markdown index 08aec57b..d97c4153 100644 --- a/website/docs/r/bandwidth_package_attachment.html.markdown +++ b/website/docs/r/bandwidth_package_attachment.html.markdown @@ -11,12 +11,13 @@ Provides a resource to manage bandwidth package attachment ## Example Usage ```hcl resource "volcengine_eip_address" "foo" { - billing_type = "PostPaidByBandwidth" - bandwidth = 1 - isp = "BGP" - name = "acc-eip" - description = "acc-test" - project_name = "default" + billing_type = "PostPaidByBandwidth" + bandwidth = 1 + isp = "BGP" + name = "acc-eip" + description = "acc-test" + project_name = "default" + security_protection_types = ["AntiDDoS_Enhanced"] } resource "volcengine_bandwidth_package" "foo" { @@ -30,6 +31,7 @@ resource "volcengine_bandwidth_package" "foo" { key = "tftest" value = "tftest" } + security_protection_types = ["AntiDDoS_Enhanced"] } resource "volcengine_bandwidth_package_attachment" "foo" { diff --git a/website/docs/r/eip_address.html.markdown b/website/docs/r/eip_address.html.markdown index 663b06ab..ddb1149d 100644 --- a/website/docs/r/eip_address.html.markdown +++ b/website/docs/r/eip_address.html.markdown @@ -32,6 +32,7 @@ The following arguments are supported: * `name` - (Optional) The name of the EIP Address. * `period` - (Optional) The period of the EIP Address, the valid value range in 1~9 or 12 or 36. Default value is 12. The period unit defaults to `Month`.This field is only effective when creating a PrePaid Eip or changing the billing_type from PostPaid to PrePaid. * `project_name` - (Optional) The ProjectName of the EIP. +* `security_protection_types` - (Optional, ForceNew) Security protection types for public IP addresses. Parameter - N: Indicates the number of security protection types, currently only supports taking 1. Value: `AntiDDoS_Enhanced` or left blank.If the value is `AntiDDoS_Enhanced`, then will create an eip with enhanced protection,(can be added to DDoS native protection (enterprise version) instance). If left blank, it indicates an eip with basic protection. * `tags` - (Optional) Tags. The `tags` object supports the following: From 86017fcbd33922f818cccb2afd781a4a12b9f8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=93=B2=E9=93=AD?= Date: Tue, 12 Dec 2023 16:20:36 +0800 Subject: [PATCH 3/6] feat: eip data remove useless param --- .../eip_address/data_source_volcengine_eip_addresses.go | 7 ------- website/docs/d/eip_addresses.html.markdown | 1 - 2 files changed, 8 deletions(-) diff --git a/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go b/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go index 7d0179e0..fc482294 100644 --- a/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go +++ b/volcengine/eip/eip_address/data_source_volcengine_eip_addresses.go @@ -60,13 +60,6 @@ func DataSourceVolcengineEipAddresses() *schema.Resource { Description: "The ProjectName of EIP.", }, "tags": ve.TagsSchema(), - "security_protection_enabled": { - Type: schema.TypeBool, - Optional: true, - Description: "Security protection. The values are as follows: " + - "`true`: Enhanced protection type for public IP (can be added to DDoS native protection (Enterprise Edition) instance). " + - "`false`: Default protection type for public IP.", - }, "output_file": { Type: schema.TypeString, Optional: true, diff --git a/website/docs/d/eip_addresses.html.markdown b/website/docs/d/eip_addresses.html.markdown index 3d5d5762..9484a282 100644 --- a/website/docs/d/eip_addresses.html.markdown +++ b/website/docs/d/eip_addresses.html.markdown @@ -27,7 +27,6 @@ The following arguments are supported: * `name` - (Optional) A name of EIP. * `output_file` - (Optional) File name where to save data source results. * `project_name` - (Optional) The ProjectName of EIP. -* `security_protection_enabled` - (Optional) Security protection. The values are as follows: `true`: Enhanced protection type for public IP (can be added to DDoS native protection (Enterprise Edition) instance). `false`: Default protection type for public IP. * `status` - (Optional) A status of EIP, the value can be `Attaching` or `Detaching` or `Attached` or `Available`. * `tags` - (Optional) Tags. From 8e39211f61dee614d06f9f90e7c9f122641c5cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=93=B2=E9=93=AD?= Date: Wed, 13 Dec 2023 14:31:08 +0800 Subject: [PATCH 4/6] feat: nat add lock --- volcengine/nat/dnat_entry/service_volcengine_dnat_entry.go | 6 ++++++ volcengine/nat/snat_entry/service_volcengine_snat_entry.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/volcengine/nat/dnat_entry/service_volcengine_dnat_entry.go b/volcengine/nat/dnat_entry/service_volcengine_dnat_entry.go index a620ff88..ef651eb5 100644 --- a/volcengine/nat/dnat_entry/service_volcengine_dnat_entry.go +++ b/volcengine/nat/dnat_entry/service_volcengine_dnat_entry.go @@ -156,6 +156,9 @@ func (s *VolcengineDnatEntryService) ModifyResource(resourceData *schema.Resourc (*call.SdkParam)["DnatEntryId"] = d.Id() return true, nil }, + LockId: func(d *schema.ResourceData) string { + return d.Get("nat_gateway_id").(string) + }, ExecuteCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (*map[string]interface{}, error) { logger.Debug(logger.ReqFormat, call.Action, call.SdkParam) return s.Client.UniversalClient.DoCall(getUniversalInfo(call.Action), call.SdkParam) @@ -181,6 +184,9 @@ func (s *VolcengineDnatEntryService) RemoveResource(resourceData *schema.Resourc logger.Debug(logger.ReqFormat, call.Action, call.SdkParam) return s.Client.UniversalClient.DoCall(getUniversalInfo(call.Action), call.SdkParam) }, + LockId: func(d *schema.ResourceData) string { + return d.Get("nat_gateway_id").(string) + }, CallError: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall, baseErr error) error { //出现错误后重试 return resource.Retry(15*time.Minute, func() *resource.RetryError { diff --git a/volcengine/nat/snat_entry/service_volcengine_snat_entry.go b/volcengine/nat/snat_entry/service_volcengine_snat_entry.go index 62e4a32e..36d6edad 100644 --- a/volcengine/nat/snat_entry/service_volcengine_snat_entry.go +++ b/volcengine/nat/snat_entry/service_volcengine_snat_entry.go @@ -163,6 +163,9 @@ func (s *VolcengineSnatEntryService) ModifyResource(resourceData *schema.Resourc (*call.SdkParam)["SnatEntryId"] = d.Id() return true, nil }, + LockId: func(d *schema.ResourceData) string { + return d.Get("nat_gateway_id").(string) + }, ExecuteCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (*map[string]interface{}, error) { logger.Debug(logger.ReqFormat, call.Action, call.SdkParam) return s.Client.NatClient.ModifySnatEntryAttributesCommon(call.SdkParam) @@ -184,6 +187,9 @@ func (s *VolcengineSnatEntryService) RemoveResource(resourceData *schema.Resourc SdkParam: &map[string]interface{}{ "SnatEntryId": resourceData.Id(), }, + LockId: func(d *schema.ResourceData) string { + return d.Get("nat_gateway_id").(string) + }, ExecuteCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (*map[string]interface{}, error) { logger.Debug(logger.ReqFormat, call.Action, call.SdkParam) return s.Client.NatClient.DeleteSnatEntryCommon(call.SdkParam) From 2dff2a4539defeb5a0d3060e0343da8146ff34ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=93=B2=E9=93=AD?= Date: Wed, 13 Dec 2023 15:50:32 +0800 Subject: [PATCH 5/6] feat: iam user data update --- .../data_source_volcengine_iam_users.go | 37 ++++++++++++++++++- .../iam_user/service_volcengine_iam_user.go | 6 +++ website/docs/d/iam_users.html.markdown | 9 ++++- website/docs/r/iam_user.html.markdown | 5 ++- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/volcengine/iam/iam_user/data_source_volcengine_iam_users.go b/volcengine/iam/iam_user/data_source_volcengine_iam_users.go index 48f90435..e6c3dfd1 100644 --- a/volcengine/iam/iam_user/data_source_volcengine_iam_users.go +++ b/volcengine/iam/iam_user/data_source_volcengine_iam_users.go @@ -42,6 +42,11 @@ func DataSourceVolcengineIamUsers() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "user_id": { + Type: schema.TypeFloat, + Computed: true, + Description: "The id of the user.", + }, "user_name": { Type: schema.TypeString, Computed: true, @@ -60,13 +65,43 @@ func DataSourceVolcengineIamUsers() *schema.Resource { "account_id": { Type: schema.TypeString, Computed: true, - Description: "The account id of the user.", + Description: "Main account ID to which the sub-user belongs.", }, "trn": { Type: schema.TypeString, Computed: true, Description: "The trn of the user.", }, + "display_name": { + Type: schema.TypeString, + Computed: true, + Description: "The display name of the user.", + }, + "mobile_phone": { + Type: schema.TypeString, + Computed: true, + Description: "The mobile phone of the user.", + }, + "mobile_phone_is_verify": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether the phone number has been verified.", + }, + "email": { + Type: schema.TypeString, + Computed: true, + Description: "The email of the user.", + }, + "email_is_verify": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether the email has been verified.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "The description of the user.", + }, }, }, }, diff --git a/volcengine/iam/iam_user/service_volcengine_iam_user.go b/volcengine/iam/iam_user/service_volcengine_iam_user.go index cd706deb..a694fb71 100644 --- a/volcengine/iam/iam_user/service_volcengine_iam_user.go +++ b/volcengine/iam/iam_user/service_volcengine_iam_user.go @@ -128,6 +128,9 @@ func (VolcengineIamUserService) WithResourceResponseHandlers(v map[string]interf return strconv.FormatFloat(i.(float64), 'f', 0, 64) }, }, + "Id": { + TargetField: "user_id", + }, }, nil } return []ve.ResourceResponseHandler{handler} @@ -226,6 +229,9 @@ func (s *VolcengineIamUserService) DatasourceResources(*schema.ResourceData, *sc IdField: "UserName", CollectField: "users", ResponseConverts: map[string]ve.ResponseConvert{ + "Id": { + TargetField: "user_id", + }, "AccountId": { TargetField: "account_id", Convert: func(i interface{}) interface{} { diff --git a/website/docs/d/iam_users.html.markdown b/website/docs/d/iam_users.html.markdown index 90134003..14b3ffa7 100644 --- a/website/docs/d/iam_users.html.markdown +++ b/website/docs/d/iam_users.html.markdown @@ -29,10 +29,17 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: * `total_count` - The total count of user query. * `users` - The collection of user. - * `account_id` - The account id of the user. + * `account_id` - Main account ID to which the sub-user belongs. * `create_date` - The create date of the user. + * `description` - The description of the user. + * `display_name` - The display name of the user. + * `email_is_verify` - Whether the email has been verified. + * `email` - The email of the user. + * `mobile_phone_is_verify` - Whether the phone number has been verified. + * `mobile_phone` - The mobile phone of the user. * `trn` - The trn of the user. * `update_date` - The update date of the user. + * `user_id` - The id of the user. * `user_name` - The name of the user. diff --git a/website/docs/r/iam_user.html.markdown b/website/docs/r/iam_user.html.markdown index 353efd2e..e57acfb4 100644 --- a/website/docs/r/iam_user.html.markdown +++ b/website/docs/r/iam_user.html.markdown @@ -27,10 +27,13 @@ The following arguments are supported: ## Attributes Reference In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. -* `account_id` - The account id of the user. +* `account_id` - Main account ID to which the sub-user belongs. * `create_date` - The create date of the user. +* `email_is_verify` - Whether the email has been verified. +* `mobile_phone_is_verify` - Whether the phone number has been verified. * `trn` - The trn of the user. * `update_date` - The update date of the user. +* `user_id` - The id of the user. ## Import From 82208ba4e2034e83c82881a3be41908da9153b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=93=B2=E9=93=AD?= Date: Wed, 13 Dec 2023 16:11:21 +0800 Subject: [PATCH 6/6] feat: opt iam user id --- volcengine/iam/iam_user/data_source_volcengine_iam_users.go | 2 +- volcengine/iam/iam_user/service_volcengine_iam_user.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/volcengine/iam/iam_user/data_source_volcengine_iam_users.go b/volcengine/iam/iam_user/data_source_volcengine_iam_users.go index e6c3dfd1..02f12c96 100644 --- a/volcengine/iam/iam_user/data_source_volcengine_iam_users.go +++ b/volcengine/iam/iam_user/data_source_volcengine_iam_users.go @@ -43,7 +43,7 @@ func DataSourceVolcengineIamUsers() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "user_id": { - Type: schema.TypeFloat, + Type: schema.TypeString, Computed: true, Description: "The id of the user.", }, diff --git a/volcengine/iam/iam_user/service_volcengine_iam_user.go b/volcengine/iam/iam_user/service_volcengine_iam_user.go index a694fb71..1e3290b1 100644 --- a/volcengine/iam/iam_user/service_volcengine_iam_user.go +++ b/volcengine/iam/iam_user/service_volcengine_iam_user.go @@ -130,6 +130,9 @@ func (VolcengineIamUserService) WithResourceResponseHandlers(v map[string]interf }, "Id": { TargetField: "user_id", + Convert: func(i interface{}) interface{} { + return strconv.FormatFloat(i.(float64), 'f', 0, 64) + }, }, }, nil } @@ -231,6 +234,9 @@ func (s *VolcengineIamUserService) DatasourceResources(*schema.ResourceData, *sc ResponseConverts: map[string]ve.ResponseConvert{ "Id": { TargetField: "user_id", + Convert: func(i interface{}) interface{} { + return strconv.FormatFloat(i.(float64), 'f', 0, 64) + }, }, "AccountId": { TargetField: "account_id",