From 8d852a21d0b469e4958828a44abcb33fae0148ff Mon Sep 17 00:00:00 2001 From: ShiChangkuo Date: Tue, 4 Feb 2020 17:33:16 +0800 Subject: [PATCH 1/3] Add description parameter in huaweicloud_identity_user_v3 --- go.mod | 2 +- go.sum | 2 ++ .../resource_huaweicloud_identity_user_v3.go | 14 +++++++++++++- .../resource_huaweicloud_identity_user_v3_test.go | 2 ++ .../openstack/identity/v3/users/requests.go | 6 ++++++ .../openstack/identity/v3/users/results.go | 3 +++ vendor/modules.txt | 5 ++++- 7 files changed, 31 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 30dee49abd..1b3bc43dc3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/go-cleanhttp v0.5.1 github.com/hashicorp/terraform-plugin-sdk v1.0.0 - github.com/huaweicloud/golangsdk v0.0.0-20191210113552-8f6bd7a6f1d8 + github.com/huaweicloud/golangsdk v0.0.0-20200204080439-744c2b9d7746 github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a github.com/mitchellh/go-homedir v1.1.0 github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // indirect diff --git a/go.sum b/go.sum index 10b4185561..941e50bf7a 100644 --- a/go.sum +++ b/go.sum @@ -125,6 +125,8 @@ github.com/huaweicloud/golangsdk v0.0.0-20191125024548-77b3c02a6faa h1:GY+Kerh4s github.com/huaweicloud/golangsdk v0.0.0-20191125024548-77b3c02a6faa/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= github.com/huaweicloud/golangsdk v0.0.0-20191210113552-8f6bd7a6f1d8 h1:7dfGs0ENjC6iJ4xRLL3Og3amBMhvVlPUeD4i/CTiIe0= github.com/huaweicloud/golangsdk v0.0.0-20191210113552-8f6bd7a6f1d8/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= +github.com/huaweicloud/golangsdk v0.0.0-20200204080439-744c2b9d7746 h1:c2HOmXuDF1VSiBdCZAPo6kbOSTt9Kh6jV87mmiegkE0= +github.com/huaweicloud/golangsdk v0.0.0-20200204080439-744c2b9d7746/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw= github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a h1:FyS/ubzBR5xJlnJGRTwe7GUHpJOR4ukYK3y+LFNffuA= github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a/go.mod h1:uoIMjNxUfXi48Ci40IXkPRbghZ1vbti6v9LCbNqRgHY= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= diff --git a/huaweicloud/resource_huaweicloud_identity_user_v3.go b/huaweicloud/resource_huaweicloud_identity_user_v3.go index 2bad5b6a88..af1e9ef271 100644 --- a/huaweicloud/resource_huaweicloud_identity_user_v3.go +++ b/huaweicloud/resource_huaweicloud_identity_user_v3.go @@ -46,7 +46,7 @@ func resourceIdentityUserV3() *schema.Resource { "name": { Type: schema.TypeString, - Optional: true, + Required: true, }, "password": { @@ -55,6 +55,11 @@ func resourceIdentityUserV3() *schema.Resource { Sensitive: true, }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "region": { Type: schema.TypeString, Optional: true, @@ -78,6 +83,7 @@ func resourceIdentityUserV3Create(d *schema.ResourceData, meta interface{}) erro DomainID: d.Get("domain_id").(string), Enabled: &enabled, Name: d.Get("name").(string), + Description: d.Get("description").(string), } log.Printf("[DEBUG] Create Options: %#v", createOpts) @@ -113,6 +119,7 @@ func resourceIdentityUserV3Read(d *schema.ResourceData, meta interface{}) error d.Set("domain_id", user.DomainID) d.Set("enabled", user.Enabled) d.Set("name", user.Name) + d.Set("description", user.Description) d.Set("region", GetRegion(d, config)) return nil @@ -149,6 +156,11 @@ func resourceIdentityUserV3Update(d *schema.ResourceData, meta interface{}) erro updateOpts.Name = d.Get("name").(string) } + if d.HasChange("description") { + hasChange = true + updateOpts.Description = d.Get("description").(string) + } + if hasChange { log.Printf("[DEBUG] Update Options: %#v", updateOpts) } diff --git a/huaweicloud/resource_huaweicloud_identity_user_v3_test.go b/huaweicloud/resource_huaweicloud_identity_user_v3_test.go index 8724e5e78e..ee475467a7 100644 --- a/huaweicloud/resource_huaweicloud_identity_user_v3_test.go +++ b/huaweicloud/resource_huaweicloud_identity_user_v3_test.go @@ -106,6 +106,7 @@ func testAccIdentityV3User_basic(userName string) string { name = "%s" password = "password123@!" enabled = true + description = "tested by terraform" } `, userName) } @@ -116,6 +117,7 @@ func testAccIdentityV3User_update(userName string) string { name = "%s" enabled = false password = "password123@!" + description = "tested by terraform" } `, userName) } diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/requests.go index 6c6f74bc06..d03e954b93 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/requests.go @@ -86,6 +86,9 @@ type CreateOpts struct { // Password is the password of the new user. Password string `json:"password,omitempty"` + + // Description is a description of the user. + Description string `json:"description,omitempty"` } // ToUserCreateMap formats a CreateOpts into a create request. @@ -133,6 +136,9 @@ type UpdateOpts struct { // Password is the password of the new user. Password string `json:"password,omitempty"` + + // Description is a description of the user. + Description string `json:"description,omitempty"` } // ToUserUpdateMap formats a UpdateOpts into an update request. diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/results.go index 969a9f889e..ccb07657bb 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/identity/v3/users/results.go @@ -13,6 +13,9 @@ type User struct { // DefaultProjectID is the ID of the default project of the user. DefaultProjectID string `json:"default_project_id"` + // Description is a description of the user. + Description string `json:"description"` + // DomainID is the domain ID the user belongs to. DomainID string `json:"domain_id"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 925d959e7a..5cb84bcfd4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -177,7 +177,7 @@ github.com/hashicorp/terraform-plugin-sdk/internal/svchost github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth # github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d github.com/hashicorp/yamux -# github.com/huaweicloud/golangsdk v0.0.0-20191125024548-77b3c02a6faa +# github.com/huaweicloud/golangsdk v0.0.0-20200204080439-744c2b9d7746 github.com/huaweicloud/golangsdk github.com/huaweicloud/golangsdk/openstack github.com/huaweicloud/golangsdk/openstack/antiddos/v1/antiddos @@ -260,6 +260,7 @@ github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/lis github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/loadbalancers github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/monitors github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/pools +github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/whitelists github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/natgateways github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/provider github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/groups @@ -279,6 +280,8 @@ github.com/huaweicloud/golangsdk/openstack/objectstorage/v1/swauth github.com/huaweicloud/golangsdk/openstack/rds/v1/datastores github.com/huaweicloud/golangsdk/openstack/rds/v1/flavors github.com/huaweicloud/golangsdk/openstack/rds/v1/instances +github.com/huaweicloud/golangsdk/openstack/rds/v3/backups +github.com/huaweicloud/golangsdk/openstack/rds/v3/configurations github.com/huaweicloud/golangsdk/openstack/rts/v1/softwareconfig github.com/huaweicloud/golangsdk/openstack/rts/v1/stackresources github.com/huaweicloud/golangsdk/openstack/rts/v1/stacks From 71f639936e9709d099406c4c6e913fee8edd4d68 Mon Sep 17 00:00:00 2001 From: ShiChangkuo Date: Tue, 4 Feb 2020 17:35:53 +0800 Subject: [PATCH 2/3] sync golangsdk vendor --- .../huaweicloud/golangsdk/openstack/client.go | 26 +++++++++++ .../lbaas_v2/certificates/requests.go | 43 ++++++++++++++++++- .../lbaas_v2/certificates/results.go | 18 ++++++++ .../extensions/lbaas_v2/listeners/requests.go | 6 +++ .../extensions/lbaas_v2/listeners/results.go | 3 ++ .../v2/extensions/security/rules/requests.go | 3 ++ .../v2/extensions/security/rules/results.go | 3 ++ .../huaweicloud/golangsdk/service_client.go | 9 ++++ 8 files changed, 110 insertions(+), 1 deletion(-) diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/client.go b/vendor/github.com/huaweicloud/golangsdk/openstack/client.go index 9d04948328..a2033d99bd 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/client.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/client.go @@ -561,6 +561,21 @@ func initClientOpts(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts, return sc, nil } +// initcommonServiceClient create a ServiceClient which can not get from clientType directly. +// firstly, we initialize a service client by "volumev2" type, the endpoint likes https://evs.{region}.{xxx.com}/v2/{project_id} +// then we replace the endpoint with the specified srv and version. +func initcommonServiceClient(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts, srv string, version string) (*golangsdk.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "volumev2") + if err != nil { + return nil, err + } + + e := strings.Replace(sc.Endpoint, "v2", version, 1) + sc.Endpoint = strings.Replace(e, "evs", srv, 1) + sc.ResourceBase = sc.Endpoint + return sc, err +} + // NewObjectStorageV1 creates a ServiceClient that may be used with the v1 // object storage package. func NewObjectStorageV1(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) { @@ -717,6 +732,11 @@ func NewComputeV11(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) return sc, err } +func NewEcsV1(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "ecs") + return sc, err +} + func NewRdsTagV1(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) { sc, err := initClientOpts(client, eo, "network") sc.Endpoint = strings.Replace(sc.Endpoint, "vpc", "rds", 1) @@ -1039,3 +1059,9 @@ func NewDDSV3(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*gol sc, err := initClientOpts(client, eo, "ddsv3") return sc, err } + +// NewLTSV2 creates a ServiceClient that may be used to access the LTS service. +func NewLTSV2(client *golangsdk.ProviderClient, eo golangsdk.EndpointOpts) (*golangsdk.ServiceClient, error) { + sc, err := initcommonServiceClient(client, eo, "lts", "v2.0") + return sc, err +} diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/requests.go index 068fadf3f9..f563bc794c 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/requests.go @@ -2,8 +2,47 @@ package certificates import ( "github.com/huaweicloud/golangsdk" + "github.com/huaweicloud/golangsdk/pagination" ) +// ListOptsBuilder allows extensions to add additional parameters to the +// List request. +type ListOptsBuilder interface { + ToCertificateListQuery() (string, error) +} + +type ListOpts struct { + ID string `q:"id"` + Name string `q:"name"` + Description string `q:"description"` + Type string `q:"type"` + Domain string `q:"domain"` + PrivateKey string `q:"private_key"` + Certificate string `q:"certificate"` + Limit int `q:"limit"` + Marker string `q:"marker"` +} + +// ToCertificateListQuery formats a ListOpts into a query string. +func (opts ListOpts) ToCertificateListQuery() (string, error) { + q, err := golangsdk.BuildQueryString(opts) + return q.String(), err +} + +func List(c *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager { + url := rootURL(c) + if opts != nil { + query, err := opts.ToCertificateListQuery() + if err != nil { + return pagination.Pager{Err: err} + } + url += query + } + return pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page { + return CertificatePage{pagination.SinglePageBase(r)} + }) +} + // CreateOptsBuilder is the interface options structs have to satisfy in order // to be used in the main Create operation in this package. Since many // extensions decorate or modify the common logic, it is useful for them to @@ -41,7 +80,9 @@ func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult) r.Err = err return } - _, r.Err = c.Post(rootURL(c), b, &r.Body, nil) + _, r.Err = c.Post(rootURL(c), b, &r.Body, &golangsdk.RequestOpts{ + OkCodes: []int{200, 201}, + }) return } diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/results.go index 949fd93d80..932346e883 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/certificates/results.go @@ -2,6 +2,7 @@ package certificates import ( "github.com/huaweicloud/golangsdk" + "github.com/huaweicloud/golangsdk/pagination" ) type Certificate struct { @@ -16,6 +17,23 @@ type Certificate struct { UpdateTime string `json:"update_time"` } +// CertificatePage is the page returned by a pager when traversing over a +// collection of certificates. +type CertificatePage struct { + pagination.SinglePageBase +} + +// ExtractCertificates accepts a Page struct, specifically a CertificatePage struct, +// and extracts the elements into a slice of Certificate structs. In other words, +// a generic collection is mapped into a relevant slice. +func ExtractCertificates(r pagination.Page) ([]Certificate, error) { + var s struct { + Certificates []Certificate `json:"certificates"` + } + err := (r.(CertificatePage)).ExtractInto(&s) + return s.Certificates, err +} + type commonResult struct { golangsdk.Result } diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/requests.go index f4d63d170c..1d5cd52123 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/requests.go @@ -112,6 +112,9 @@ type CreateOpts struct { // A list of references to TLS secrets. SniContainerRefs []string `json:"sni_container_refs,omitempty"` + // Specifies the security policy used by the listener. + TlsCiphersPolicy string `json:"tls_ciphers_policy,omitempty"` + // The administrative state of the Listener. A valid value is true (UP) // or false (DOWN). AdminStateUp *bool `json:"admin_state_up,omitempty"` @@ -168,6 +171,9 @@ type UpdateOpts struct { // A list of references to TLS secrets. SniContainerRefs []string `json:"sni_container_refs,omitempty"` + // Specifies the security policy used by the listener. + TlsCiphersPolicy string `json:"tls_ciphers_policy,omitempty"` + // The administrative state of the Listener. A valid value is true (UP) // or false (DOWN). AdminStateUp *bool `json:"admin_state_up,omitempty"` diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/results.go index c4486048c9..aef19f1360 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/lbaas_v2/listeners/results.go @@ -50,6 +50,9 @@ type Listener struct { // A reference to a Barbican container of TLS secrets. DefaultTlsContainerRef string `json:"default_tls_container_ref"` + // Specifies the security policy used by the listener. + TlsCiphersPolicy string `json:"tls_ciphers_policy"` + // The administrative state of the Listener. A valid value is true (UP) or false (DOWN). AdminStateUp bool `json:"admin_state_up"` diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/requests.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/requests.go index 0d0450e3d4..20637bb2b7 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/requests.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/requests.go @@ -88,6 +88,9 @@ type CreateOpts struct { // group rule is applied. Direction RuleDirection `json:"direction" required:"true"` + // String description of each rule, optional + Description string `json:"description,omitempty"` + // Must be "IPv4" or "IPv6", and addresses represented in CIDR must match the // ingress or egress rules. EtherType RuleEtherType `json:"ethertype" required:"true"` diff --git a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/results.go b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/results.go index f2d48c47fc..827293ddab 100644 --- a/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/results.go +++ b/vendor/github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/security/rules/results.go @@ -17,6 +17,9 @@ type SecGroupRule struct { // instance. An egress rule is applied to traffic leaving the instance. Direction string + // Descripton of the rule + Description string `json:"description"` + // Must be IPv4 or IPv6, and addresses represented in CIDR must match the // ingress or egress rules. EtherType string `json:"ethertype"` diff --git a/vendor/github.com/huaweicloud/golangsdk/service_client.go b/vendor/github.com/huaweicloud/golangsdk/service_client.go index f030bd79ec..9d18096d27 100644 --- a/vendor/github.com/huaweicloud/golangsdk/service_client.go +++ b/vendor/github.com/huaweicloud/golangsdk/service_client.go @@ -126,6 +126,15 @@ func (client *ServiceClient) DeleteWithResponse(url string, JSONResponse interfa return client.Request("DELETE", url, opts) } +// DeleteWithBodyResp calls `Request` with the "DELETE" HTTP verb. +func (client *ServiceClient) DeleteWithBodyResp(url string, JSONBody interface{}, JSONResponse interface{}, opts *RequestOpts) (*http.Response, error) { + if opts == nil { + opts = new(RequestOpts) + } + client.initReqOpts(url, JSONBody, JSONResponse, opts) + return client.Request("DELETE", url, opts) +} + func (client *ServiceClient) setMicroversionHeader(opts *RequestOpts) { switch client.Type { case "compute": From b280e2eb7312ab6591a7469fa375dbe49854ba8b Mon Sep 17 00:00:00 2001 From: ShiChangkuo Date: Wed, 5 Feb 2020 11:18:36 +0800 Subject: [PATCH 3/3] Support tags in s3_bucket --- huaweicloud/resource_huaweicloud_s3_bucket.go | 27 +++++++++---------- website/docs/d/s3_bucket_object.html.markdown | 1 + website/docs/r/s3_bucket.html.markdown | 10 +++++-- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/huaweicloud/resource_huaweicloud_s3_bucket.go b/huaweicloud/resource_huaweicloud_s3_bucket.go index 7ecea6b7e0..5e1d9b778c 100644 --- a/huaweicloud/resource_huaweicloud_s3_bucket.go +++ b/huaweicloud/resource_huaweicloud_s3_bucket.go @@ -353,11 +353,11 @@ func resourceS3BucketUpdate(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error creating HuaweiCloud s3 client: %s", err) } - /* - if err := setTagsS3(s3conn, d); err != nil { - return fmt.Errorf("%q: %s", d.Get("bucket").(string), err) - } - */ + // update tags + if err := setTagsS3(s3conn, d); err != nil { + return fmt.Errorf("%q: %s", d.Get("bucket").(string), err) + } + if d.HasChange("policy") { if err := resourceS3BucketPolicyUpdate(s3conn, d); err != nil { return err @@ -778,16 +778,15 @@ func resourceS3BucketRead(d *schema.ResourceData, meta interface{}) error { } } - /* - tagSet, err := getTagSetS3(s3conn, d.Id()) - if err != nil { - return err - } + // get tags + tagSet, err := getTagSetS3(s3conn, d.Id()) + if err != nil { + return err + } - if err := d.Set("tags", tagsToMapS3(tagSet)); err != nil { - return err - } - */ + if err := d.Set("tags", tagsToMapS3(tagSet)); err != nil { + return err + } // UNUSED? //d.Set("arn", fmt.Sprintf("arn:%s:s3:::%s", meta.(*Config).partition, d.Id())) diff --git a/website/docs/d/s3_bucket_object.html.markdown b/website/docs/d/s3_bucket_object.html.markdown index cd8f2f7b18..1dbb84e10c 100644 --- a/website/docs/d/s3_bucket_object.html.markdown +++ b/website/docs/d/s3_bucket_object.html.markdown @@ -20,6 +20,7 @@ data "huaweicloud_s3_bucket_object" "b" { bucket = "my-test-bucket" key = "hello-world.zip" } +``` ## Argument Reference diff --git a/website/docs/r/s3_bucket.html.markdown b/website/docs/r/s3_bucket.html.markdown index 8b6043da17..91af7ca5c8 100644 --- a/website/docs/r/s3_bucket.html.markdown +++ b/website/docs/r/s3_bucket.html.markdown @@ -12,12 +12,17 @@ Provides a S3 bucket resource. ## Example Usage -### Private Bucket w/ Tags +### Private Bucket with Tags ```hcl resource "huaweicloud_s3_bucket" "b" { bucket = "my-tf-test-bucket" acl = "private" + + tags = { + foo = "bar" + Env = "Test" + } } ``` @@ -147,8 +152,9 @@ The following arguments are supported: * `bucket` - (Optional, Forces new resource) The name of the bucket. If omitted, Terraform will assign a random, unique name. * `bucket_prefix` - (Optional, Forces new resource) Creates a unique bucket name beginning with the specified prefix. Conflicts with `bucket`. * `acl` - (Optional) The [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) to apply. Defaults to "private". -* `policy` - (Optional) A valid [bucket policy](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html) JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a `terraform plan`. In this case, please make sure you use the verbose/specific version of the policy. +* `tags` - (Optional) A mapping of tags to assign to the bucket. * `force_destroy` - (Optional, Default:false ) A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are *not* recoverable. +* `policy` - (Optional) A valid [bucket policy](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html) JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a `terraform plan`. In this case, please make sure you use the verbose/specific version of the policy. * `website` - (Optional) A website object (documented below). * `cors_rule` - (Optional) A rule of [Cross-Origin Resource Sharing](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) (documented below). * `versioning` - (Optional) A state of [versioning](https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html) (documented below)