Skip to content

Commit 876ec6e

Browse files
authored
feat:remove cos storage-class validation (#1434)
* feat:remove cos storageclass validation * add changelog * adjust e2e case name * adjust e2e case name * adjust storage_class desc by office website
1 parent c957c7e commit 876ec6e

File tree

7 files changed

+34
-44
lines changed

7 files changed

+34
-44
lines changed

.changelog/1434.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_cos_bucket: enhance the storage_class of lifecycle
3+
```
4+
5+
```release-note:enhancement
6+
resource/tencentcloud_cos_bucket_object: enhance the storage_class of lifecycle
7+
```

tencentcloud/resource_tc_cos_bucket.go

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,6 @@ import (
253253
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
254254
)
255255

256-
const (
257-
tencentCloudCosStorageClassStandard = "STANDARD"
258-
tencentCloudCosStorageClassStandardIA = "STANDARD_IA"
259-
tencentCloudCosStorageClassArchive = "ARCHIVE"
260-
)
261-
262-
var (
263-
availableCosStorageClass = []string{
264-
tencentCloudCosStorageClassStandard,
265-
tencentCloudCosStorageClassStandardIA,
266-
tencentCloudCosStorageClassArchive,
267-
}
268-
)
269-
270256
func originPullRules() *schema.Resource {
271257
return &schema.Resource{
272258
Schema: map[string]*schema.Schema{
@@ -603,10 +589,9 @@ func resourceTencentCloudCosBucket() *schema.Resource {
603589
Description: "Specifies the number of days after object creation when the specific rule action takes effect.",
604590
},
605591
"storage_class": {
606-
Type: schema.TypeString,
607-
Required: true,
608-
ValidateFunc: validateAllowedStringValue(availableCosStorageClass),
609-
Description: "Specifies the storage class to which you want the object to transition. Available values include `STANDARD`, `STANDARD_IA` and `ARCHIVE`.",
592+
Type: schema.TypeString,
593+
Required: true,
594+
Description: "Specifies the storage class to which you want the object to transition. Available values include `STANDARD_IA`, `MAZ_STANDARD_IA`, `INTELLIGENT_TIERING`, `MAZ_INTELLIGENT_TIERING`, `ARCHIVE`, `DEEP_ARCHIVE`. For more information, please refer to: https://cloud.tencent.com/document/product/436/33417.",
610595
},
611596
},
612597
},
@@ -653,10 +638,9 @@ func resourceTencentCloudCosBucket() *schema.Resource {
653638
Description: "Number of days after non current object creation when the specific rule action takes effect.",
654639
},
655640
"storage_class": {
656-
Type: schema.TypeString,
657-
Required: true,
658-
ValidateFunc: validateAllowedStringValue(availableCosStorageClass),
659-
Description: "Specifies the storage class to which you want the non current object to transition. Available values include `STANDARD`, `STANDARD_IA` and `ARCHIVE`.",
641+
Type: schema.TypeString,
642+
Required: true,
643+
Description: "Specifies the storage class to which you want the non current object to transition. Available values include `STANDARD_IA`, `MAZ_STANDARD_IA`, `INTELLIGENT_TIERING`, `MAZ_INTELLIGENT_TIERING`, `ARCHIVE`, `DEEP_ARCHIVE`. For more information, please refer to: https://cloud.tencent.com/document/product/436/33417.",
660644
},
661645
},
662646
},

tencentcloud/resource_tc_cos_bucket_object.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ func resourceTencentCloudCosBucketObject() *schema.Resource {
117117
Description: "A standard MIME type describing the format of the object data.",
118118
},
119119
"storage_class": {
120-
Type: schema.TypeString,
121-
Optional: true,
122-
Computed: true,
123-
ValidateFunc: validateAllowedStringValue(availableCosStorageClass),
124-
Description: "Object storage type, Available values include `STANDARD`, `STANDARD_IA` and `ARCHIVE`.",
120+
Type: schema.TypeString,
121+
Optional: true,
122+
Computed: true,
123+
Description: "Object storage type, Available values include `STANDARD_IA`, `MAZ_STANDARD_IA`, `INTELLIGENT_TIERING`, `MAZ_INTELLIGENT_TIERING`, `ARCHIVE`, `DEEP_ARCHIVE`. For more information, please refer to: https://cloud.tencent.com/document/product/436/33417.",
125124
},
126125
"etag": {
127126
Type: schema.TypeString,

tencentcloud/resource_tc_cos_bucket_object_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1515
)
1616

17-
func TestAccTencentCloudCosBucketObject_source(t *testing.T) {
17+
func TestAccTencentCloudCosBucketObjectResource_source(t *testing.T) {
1818
t.Parallel()
1919

2020
tmpFile, err := ioutil.TempFile("", "tf-test-cos-object")
@@ -50,7 +50,7 @@ func TestAccTencentCloudCosBucketObject_source(t *testing.T) {
5050
})
5151
}
5252

53-
func TestAccTencentCloudCosBucketObject_content(t *testing.T) {
53+
func TestAccTencentCloudCosBucketObjectResource_content(t *testing.T) {
5454
t.Parallel()
5555

5656
resource.Test(t, resource.TestCase{
@@ -70,7 +70,7 @@ func TestAccTencentCloudCosBucketObject_content(t *testing.T) {
7070
})
7171
}
7272

73-
func TestAccTencentCloudCosBucketObject_tags(t *testing.T) {
73+
func TestAccTencentCloudCosBucketObjectResource_tags(t *testing.T) {
7474
t.Parallel()
7575

7676
resource.Test(t, resource.TestCase{
@@ -90,7 +90,7 @@ func TestAccTencentCloudCosBucketObject_tags(t *testing.T) {
9090
})
9191
}
9292

93-
func TestAccTencentCloudCosBucketObject_storageClass(t *testing.T) {
93+
func TestAccTencentCloudCosBucketObjectResource_storageClass(t *testing.T) {
9494
t.Parallel()
9595

9696
resource.Test(t, resource.TestCase{
@@ -109,7 +109,7 @@ func TestAccTencentCloudCosBucketObject_storageClass(t *testing.T) {
109109
})
110110
}
111111

112-
func TestAccTencentCloudCosBucketObject_acl(t *testing.T) {
112+
func TestAccTencentCloudCosBucketObjectResource_acl(t *testing.T) {
113113
t.Parallel()
114114

115115
resource.Test(t, resource.TestCase{

tencentcloud/resource_tc_cos_bucket_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func testSweepCosBuckets(region string) error {
6666
return nil
6767
}
6868

69-
func TestAccTencentCloudCosBucket_basic(t *testing.T) {
69+
func TestAccTencentCloudCosBucketResource_basic(t *testing.T) {
7070
t.Parallel()
7171

7272
resource.Test(t, resource.TestCase{
@@ -101,7 +101,7 @@ func TestAccTencentCloudCosBucket_basic(t *testing.T) {
101101
})
102102
}
103103

104-
func TestAccTencentCloudCosBucket_ACL(t *testing.T) {
104+
func TestAccTencentCloudCosBucketResource_ACL(t *testing.T) {
105105
t.Parallel()
106106

107107
resource.Test(t, resource.TestCase{
@@ -136,7 +136,7 @@ func TestAccTencentCloudCosBucket_ACL(t *testing.T) {
136136
})
137137
}
138138

139-
func TestAccTencentCloudCosBucket_tags(t *testing.T) {
139+
func TestAccTencentCloudCosBucketResource_tags(t *testing.T) {
140140
t.Parallel()
141141

142142
resource.Test(t, resource.TestCase{
@@ -170,7 +170,7 @@ func TestAccTencentCloudCosBucket_tags(t *testing.T) {
170170
})
171171
}
172172

173-
func TestAccTencentCloudCosBucket_cors(t *testing.T) {
173+
func TestAccTencentCloudCosBucketResource_cors(t *testing.T) {
174174
t.Parallel()
175175

176176
resource.Test(t, resource.TestCase{
@@ -219,7 +219,7 @@ func TestAccTencentCloudCosBucket_cors(t *testing.T) {
219219
})
220220
}
221221

222-
func TestAccTencentCloudCosBucket_lifecycle(t *testing.T) {
222+
func TestAccTencentCloudCosBucketResource_lifecycle(t *testing.T) {
223223
t.Parallel()
224224

225225
resource.Test(t, resource.TestCase{
@@ -271,7 +271,7 @@ func TestAccTencentCloudCosBucket_lifecycle(t *testing.T) {
271271
})
272272
}
273273

274-
func TestAccTencentCloudCosBucket_website(t *testing.T) {
274+
func TestAccTencentCloudCosBucketResource_website(t *testing.T) {
275275
t.Parallel()
276276

277277
resource.Test(t, resource.TestCase{
@@ -308,7 +308,7 @@ func TestAccTencentCloudCosBucket_website(t *testing.T) {
308308
})
309309
}
310310

311-
func TestAccTencentCloudCosBucket_MAZ(t *testing.T) {
311+
func TestAccTencentCloudCosBucketResource_MAZ(t *testing.T) {
312312
t.Parallel()
313313

314314
resource.Test(t, resource.TestCase{
@@ -333,7 +333,7 @@ func TestAccTencentCloudCosBucket_MAZ(t *testing.T) {
333333
})
334334
}
335335

336-
func TestAccTencentCloudCosBucket_originPull(t *testing.T) {
336+
func TestAccTencentCloudCosBucketResource_originPull(t *testing.T) {
337337
t.Parallel()
338338

339339
resource.Test(t, resource.TestCase{
@@ -451,7 +451,7 @@ func TestAccTencentCloudCosBucket_originDomain(t *testing.T) {
451451
}
452452
*/
453453

454-
func TestAccTencentCloudCosBucket_replication(t *testing.T) {
454+
func TestAccTencentCloudCosBucketResource_replication(t *testing.T) {
455455
t.Parallel()
456456

457457
resource.Test(t, resource.TestCase{

website/docs/r/cos_bucket.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ The `non_current_expiration` object supports the following:
285285

286286
The `non_current_transition` object supports the following:
287287

288-
* `storage_class` - (Required, String) Specifies the storage class to which you want the non current object to transition. Available values include `STANDARD`, `STANDARD_IA` and `ARCHIVE`.
288+
* `storage_class` - (Required, String) Specifies the storage class to which you want the non current object to transition. Available values include `STANDARD_IA`, `MAZ_STANDARD_IA`, `INTELLIGENT_TIERING`, `MAZ_INTELLIGENT_TIERING`, `ARCHIVE`, `DEEP_ARCHIVE`. For more information, please refer to: https://cloud.tencent.com/document/product/436/33417.
289289
* `non_current_days` - (Optional, Int) Number of days after non current object creation when the specific rule action takes effect.
290290

291291
The `origin_domain_rules` object supports the following:
@@ -316,7 +316,7 @@ The `replica_rules` object supports the following:
316316

317317
The `transition` object supports the following:
318318

319-
* `storage_class` - (Required, String) Specifies the storage class to which you want the object to transition. Available values include `STANDARD`, `STANDARD_IA` and `ARCHIVE`.
319+
* `storage_class` - (Required, String) Specifies the storage class to which you want the object to transition. Available values include `STANDARD_IA`, `MAZ_STANDARD_IA`, `INTELLIGENT_TIERING`, `MAZ_INTELLIGENT_TIERING`, `ARCHIVE`, `DEEP_ARCHIVE`. For more information, please refer to: https://cloud.tencent.com/document/product/436/33417.
320320
* `date` - (Optional, String) Specifies the date after which you want the corresponding action to take effect.
321321
* `days` - (Optional, Int) Specifies the number of days after object creation when the specific rule action takes effect.
322322

website/docs/r/cos_bucket_object.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The following arguments are supported:
5252
* `content` - (Optional, String) Literal string value to use as the object content, which will be uploaded as UTF-8-encoded text.
5353
* `etag` - (Optional, String) The ETag generated for the object (an MD5 sum of the object content).
5454
* `source` - (Optional, String) The path to the source file being uploaded to the bucket.
55-
* `storage_class` - (Optional, String) Object storage type, Available values include `STANDARD`, `STANDARD_IA` and `ARCHIVE`.
55+
* `storage_class` - (Optional, String) Object storage type, Available values include `STANDARD_IA`, `MAZ_STANDARD_IA`, `INTELLIGENT_TIERING`, `MAZ_INTELLIGENT_TIERING`, `ARCHIVE`, `DEEP_ARCHIVE`. For more information, please refer to: https://cloud.tencent.com/document/product/436/33417.
5656
* `tags` - (Optional, Map) Tag of the object.
5757

5858
## Attributes Reference

0 commit comments

Comments
 (0)