diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eb52bb9..194424a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.38.3 (2023-11-22) + +BUG FIXES: + +* `datasource/ucloud_iam_policy_document`: fix data type of version. + ## 1.38.2 (2023-09-27) FEATURES: diff --git a/examples/rssd/main.tf b/examples/rssd/main.tf index 039ed81e..ffa8d245 100644 --- a/examples/rssd/main.tf +++ b/examples/rssd/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { ucloud = { source = "ucloud/ucloud" - version = "~>1.38.2" + version = "~>1.38.3" } } } diff --git a/ucloud/config.go b/ucloud/config.go index dcefc50b..b93c9f04 100644 --- a/ucloud/config.go +++ b/ucloud/config.go @@ -72,7 +72,7 @@ func (c *Config) Client() (*UCloudClient, error) { // enable auto retry with http/connection error cfg.MaxRetries = c.MaxRetries cfg.LogLevel = log.PanicLevel - cfg.UserAgent = "Terraform-UCloud/1.38.2" + cfg.UserAgent = "Terraform-UCloud/1.38.3" cfg.BaseUrl = c.BaseURL cred := auth.NewCredential() diff --git a/ucloud/data_source_ucloud_iam_policy_document.go b/ucloud/data_source_ucloud_iam_policy_document.go index 0fc5878a..d6bc2ca2 100644 --- a/ucloud/data_source_ucloud_iam_policy_document.go +++ b/ucloud/data_source_ucloud_iam_policy_document.go @@ -12,10 +12,10 @@ func dataSourceUCloudIAMPolicyDocument() *schema.Resource { Read: dataSourceUCloudIAMPolicyDocumentRead, Schema: map[string]*schema.Schema{ "version": { - Type: schema.TypeInt, + Type: schema.TypeString, Optional: true, - Default: 1, - ValidateFunc: validation.IntInSlice([]int{1}), + Default: "1", + ValidateFunc: validation.StringInSlice([]string{"1"}, false), }, "statement": { Type: schema.TypeList, @@ -58,7 +58,7 @@ func dataSourceUCloudIAMPolicyDocument() *schema.Resource { } func dataSourceUCloudIAMPolicyDocumentRead(d *schema.ResourceData, meta interface{}) error { if v, ok := d.GetOk("statement"); ok { - doc, err := assembleDataSourcePolicyJSON(v.([]interface{}), d.Get("version").(int)) + doc, err := assembleDataSourcePolicyJSON(v.([]interface{}), d.Get("version").(string)) if err != nil { return err } @@ -75,7 +75,7 @@ func dataSourceUCloudIAMPolicyDocumentRead(d *schema.ResourceData, meta interfac return nil } -func assembleDataSourcePolicyJSON(statements []interface{}, version int) (string, error) { +func assembleDataSourcePolicyJSON(statements []interface{}, version string) (string, error) { document := PolicyDocument{Version: version} for _, v := range statements { var statement PolicyStatement @@ -102,6 +102,6 @@ type PolicyStatement struct { Resource []string `json:"Resource"` } type PolicyDocument struct { - Version int `json:"Version"` + Version string `json:"Version"` Statement []PolicyStatement `json:"Statement"` } diff --git a/ucloud/data_source_ucloud_iam_policy_document_test.go b/ucloud/data_source_ucloud_iam_policy_document_test.go index 4b85e70b..fad47480 100644 --- a/ucloud/data_source_ucloud_iam_policy_document_test.go +++ b/ucloud/data_source_ucloud_iam_policy_document_test.go @@ -36,7 +36,7 @@ func TestAccUCloudIAMPolicyDocument_basic(t *testing.T) { const testAccDataIAMPolicyDocumentConfig = ` data "ucloud_iam_policy_document" foo { - version = 1 + version = "1" statement { effect = "Allow" @@ -46,7 +46,7 @@ data "ucloud_iam_policy_document" foo { ] resource = [ - "ucs:uhost:*::instance/uhost-xxx", + "ucs:uhost:*:123:instance/uhost-xxx", ] } statement { diff --git a/website/docs/d/iam_policy_document.html.markdown b/website/docs/d/iam_policy_document.html.markdown index 744ba64a..e9305cda 100644 --- a/website/docs/d/iam_policy_document.html.markdown +++ b/website/docs/d/iam_policy_document.html.markdown @@ -14,7 +14,7 @@ Generates an IAM policy document in JSON format for use with resources that expe ```hcl data "ucloud_iam_policy_document" foo { - version = 1 + version = "1" statement { effect = "Allow" diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index d4f150bb..0f9bba12 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -23,7 +23,7 @@ terraform { required_providers { ucloud = { source = "ucloud/ucloud" - version = "~>1.38.2" + version = "~>1.38.3" } } } @@ -91,7 +91,7 @@ terraform { required_providers { ucloud = { source = "ucloud/ucloud" - version = "~>1.38.2" + version = "~>1.38.3" } } }