Skip to content

Commit 585019e

Browse files
authored
fix(cos): [137134617] tencentcloud_cos_bucket_policy update doc (#3155)
* add * add
1 parent a37e6d2 commit 585019e

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

.changelog/3155.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_cos_bucket_policy: update doc
3+
```

tencentcloud/services/cos/resource_tc_cos_bucket_policy.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ Provides a COS resource to create a COS bucket policy and set its attributes.
33
Example Usage
44

55
```hcl
6-
resource "tencentcloud_cos_bucket_policy" "cos_policy" {
7-
bucket = "mycos-1258798060"
6+
data "tencentcloud_user_info" "info" {}
87
8+
locals {
9+
app_id = data.tencentcloud_user_info.info.app_id
10+
}
11+
12+
resource "tencentcloud_cos_bucket" "example" {
13+
bucket = "private-bucket-${local.app_id}"
14+
acl = "private"
15+
}
16+
17+
resource "tencentcloud_cos_bucket_policy" "example" {
18+
bucket = tencentcloud_cos_bucket.example.id
919
policy = <<EOF
1020
{
1121
"version": "2.0",
@@ -22,7 +32,7 @@ resource "tencentcloud_cos_bucket_policy" "cos_policy" {
2232
],
2333
"Effect": "allow",
2434
"Resource": [
25-
"qcs::cos:<bucket region>:uid/<your-account-id>:<bucket name>/*"
35+
"qcs::cos:<bucket region>:uid/<your-appid-id>:<your-bucket-name>/*"
2636
]
2737
}
2838
]
@@ -36,5 +46,5 @@ Import
3646
COS bucket policy can be imported, e.g.
3747

3848
```
39-
$ terraform import tencentcloud_cos_bucket_policy.bucket bucket-name
49+
$ terraform import tencentcloud_cos_bucket_policy.example private-bucket-1309118521
4050
```

website/docs/r/cos_bucket_policy.html.markdown

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@ Provides a COS resource to create a COS bucket policy and set its attributes.
1414
## Example Usage
1515

1616
```hcl
17-
resource "tencentcloud_cos_bucket_policy" "cos_policy" {
18-
bucket = "mycos-1258798060"
17+
data "tencentcloud_user_info" "info" {}
1918
19+
locals {
20+
app_id = data.tencentcloud_user_info.info.app_id
21+
}
22+
23+
resource "tencentcloud_cos_bucket" "example" {
24+
bucket = "private-bucket-${local.app_id}"
25+
acl = "private"
26+
}
27+
28+
resource "tencentcloud_cos_bucket_policy" "example" {
29+
bucket = tencentcloud_cos_bucket.example.id
2030
policy = <<EOF
2131
{
2232
"version": "2.0",
@@ -33,7 +43,7 @@ resource "tencentcloud_cos_bucket_policy" "cos_policy" {
3343
],
3444
"Effect": "allow",
3545
"Resource": [
36-
"qcs::cos:<bucket region>:uid/<your-account-id>:<bucket name>/*"
46+
"qcs::cos:<bucket region>:uid/<your-appid-id>:<your-bucket-name>/*"
3747
]
3848
}
3949
]
@@ -62,6 +72,6 @@ In addition to all arguments above, the following attributes are exported:
6272
COS bucket policy can be imported, e.g.
6373

6474
```
65-
$ terraform import tencentcloud_cos_bucket_policy.bucket bucket-name
75+
$ terraform import tencentcloud_cos_bucket_policy.example private-bucket-1309118521
6676
```
6777

0 commit comments

Comments
 (0)