diff --git a/docs/resources/vpcep_endpoint.md b/docs/resources/vpcep_endpoint.md index e6ecfb95f8..8aa9e0d70d 100644 --- a/docs/resources/vpcep_endpoint.md +++ b/docs/resources/vpcep_endpoint.md @@ -174,11 +174,6 @@ The following arguments are supported: -> Please refer to [official document](https://support.huaweicloud.com/intl/en-us/usermanual-iam/iam_01_0017.html) for the data structure rules of the policy. Just pay attention to the fields `Effect`, `Action` and `Resource`. -* `policy_document` - (Optional, String) Specifies the IAM 5.0 policies. This parameter is only available when - `enable_policy` of the VPC endpoint services is set to **true**. Defaults to full access. - The VPC endpoint services of Object Storage Service (OBS) and Scalable File Service (SFS) do not support configuring - this parameter. - * `tags` - (Optional, Map) The key/value pairs to associate with the VPC endpoint. ## Attribute Reference diff --git a/go.mod b/go.mod index e17bca0b73..d3101b8a3a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 - github.com/chnsz/golangsdk v0.0.0-20240904093004-8405480f47e9 + github.com/chnsz/golangsdk v0.0.0-20240906025604-372d490f10dc github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index b1d7094cda..525214a19f 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6 github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chnsz/golangsdk v0.0.0-20240904093004-8405480f47e9 h1:TnwaufPiSeAii/Dp8QiWczguUT/1XTwg2FMnDtNMuvk= -github.com/chnsz/golangsdk v0.0.0-20240904093004-8405480f47e9/go.mod h1:Erm4hDWxXgAdbkG3+hhJFgRzEL1TvvcroWzw2Gax4uI= +github.com/chnsz/golangsdk v0.0.0-20240906025604-372d490f10dc h1:i7vU0KgfWXtnrFc93qe57Jbs10OS3n5rUwmvabIulcI= +github.com/chnsz/golangsdk v0.0.0-20240906025604-372d490f10dc/go.mod h1:Erm4hDWxXgAdbkG3+hhJFgRzEL1TvvcroWzw2Gax4uI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/huaweicloud/services/vpcep/resource_huaweicloud_vpcep_endpoint.go b/huaweicloud/services/vpcep/resource_huaweicloud_vpcep_endpoint.go index 520362094f..e457ef0378 100644 --- a/huaweicloud/services/vpcep/resource_huaweicloud_vpcep_endpoint.go +++ b/huaweicloud/services/vpcep/resource_huaweicloud_vpcep_endpoint.go @@ -109,11 +109,16 @@ func ResourceVPCEndpoint() *schema.Resource { return equal }, }, - // Field `policy_document` was not tested due to insufficient testing conditions. + // Deprecated + // The field type provided in the API document is different from the actual returned type. + // As a result, an error is reported when the resource is imported. "policy_document": { Type: schema.TypeString, Optional: true, Computed: true, + Description: utils.SchemaDesc( + `Specifies the endpoint policy information`, utils.SchemaDescInput{Deprecated: true}, + ), }, "tags": common.TagsSchema(), "status": { @@ -177,7 +182,6 @@ func resourceVPCEndpointCreate(ctx context.Context, d *schema.ResourceData, meta EnableWhitelist: utils.Bool(enableACL), Tags: utils.ExpandResourceTags(d.Get("tags").(map[string]interface{})), PolicyStatement: policyStatementOpts, - PolicyDocument: d.Get("policy_document").(string), } routeTables := d.Get("routetables").(*schema.Set) @@ -250,7 +254,6 @@ func resourceVPCEndpointRead(_ context.Context, d *schema.ResourceData, meta int d.Set("packet_id", ep.MarkerID), d.Set("tags", utils.TagsToMap(ep.Tags)), d.Set("policy_statement", string(policyStatements)), - d.Set("policy_document", ep.PolicyDocument), ) // if the VPC endpoint type is interface, the field is used and need to be set @@ -304,7 +307,7 @@ func resourceVPCEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta return diag.Errorf("error updating tags of VPC endpoint %s: %s", d.Id(), tagErr) } } - if d.HasChanges("policy_statement", "policy_document") { + if d.HasChanges("policy_statement") { policyStatementOpts, err := buildPolicyStatement(d) if err != nil { return diag.FromErr(err) @@ -312,7 +315,6 @@ func resourceVPCEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta updatePolicyOpts := endpoints.UpdatePolicyOpts{ PolicyStatement: policyStatementOpts, - PolicyDocument: d.Get("policy_document").(string), } _, err = endpoints.UpdatePolicy(vpcepClient, updatePolicyOpts, d.Id()).Extract() if err != nil { diff --git a/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/requests.go b/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/requests.go index e304530c7a..8007546308 100644 --- a/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/requests.go +++ b/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/requests.go @@ -40,8 +40,6 @@ type CreateOpts struct { Description string `json:"description,omitempty"` // Specifies the endpoint policy information for the gateway type PolicyStatement []PolicyStatement `json:"policy_statement,omitempty"` - // Specifies the endpoint policy information - PolicyDocument string `json:"policy_document,omitempty"` // Specifies the IP version IPVersion string `json:"ip_version,omitempty"` // Specifies the IPv6 address @@ -115,8 +113,6 @@ type UpdatePolicyOptsBuilder interface { type UpdatePolicyOpts struct { // Specifies the endpoint policy information for the gateway type PolicyStatement []PolicyStatement `json:"policy_statement,omitempty"` - // Specifies the endpoint policy information - PolicyDocument string `json:"policy_document,omitempty"` } // UpdatePolicyOptsMap assembles a request body based on the contents of a UpdatePolicyOpts. diff --git a/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/results.go b/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/results.go index 4b7e2ecdc6..bd8d00779e 100644 --- a/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/results.go +++ b/vendor/github.com/chnsz/golangsdk/openstack/vpcep/v1/endpoints/results.go @@ -55,8 +55,6 @@ type Endpoint struct { Description string `json:"description"` // The gateway type endpoint policy information PolicyStatement []PolicyStatementResult `json:"policy_statement"` - // the endpoint policy information - PolicyDocument string `json:"policy_document"` // The cluster ID associated with the instance EndpointPoolID string `json:"endpoint_pool_id"` // The public border group information of the terminal node corresponding to the pool diff --git a/vendor/modules.txt b/vendor/modules.txt index 19e1a07e71..90090a7a19 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -13,7 +13,7 @@ github.com/apparentlymart/go-cidr/cidr # github.com/apparentlymart/go-textseg/v13 v13.0.0 ## explicit; go 1.16 github.com/apparentlymart/go-textseg/v13/textseg -# github.com/chnsz/golangsdk v0.0.0-20240904093004-8405480f47e9 +# github.com/chnsz/golangsdk v0.0.0-20240906025604-372d490f10dc ## explicit; go 1.14 github.com/chnsz/golangsdk github.com/chnsz/golangsdk/auth