Skip to content

Commit 765c2c3

Browse files
authored
fix(cam): [122268974] CAM update doc (#3190)
* add * add
1 parent bc4be5e commit 765c2c3

19 files changed

+408
-303
lines changed
Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
1-
Provides a resource to create a cam access_key
1+
Provides a resource to create a CAM access key
22

33
Example Usage
44

5+
Create access key
6+
57
```hcl
6-
resource "tencentcloud_cam_access_key" "access_key" {
7-
target_uin = 100033690181
8+
data "tencentcloud_user_info" "info" {}
9+
10+
resource "tencentcloud_cam_access_key" "example" {
11+
target_uin = data.tencentcloud_user_info.info.uin
812
}
913
```
10-
Update
14+
15+
Update access key
16+
1117
```hcl
12-
resource "tencentcloud_cam_access_key" "access_key" {
13-
target_uin = 100033690181
14-
status = "Inactive"
18+
data "tencentcloud_user_info" "info" {}
19+
20+
resource "tencentcloud_cam_access_key" "example" {
21+
target_uin = data.tencentcloud_user_info.info.uin
22+
status = "Inactive"
1523
}
1624
```
17-
Encrypted
25+
26+
Encrypted access key
27+
1828
```hcl
19-
resource "tencentcloud_cam_access_key" "access_key" {
20-
target_uin = 100033690181
21-
pgp_key = "keybase:some_person_that_exists"
29+
data "tencentcloud_user_info" "info" {}
30+
31+
resource "tencentcloud_cam_access_key" "example" {
32+
target_uin = data.tencentcloud_user_info.info.uin
33+
pgp_key = "keybase:some_person_that_exists"
2234
}
2335
```
36+
2437
Import
2538

26-
cam access_key can be imported using the id, e.g.
39+
cam access key can be imported using the id, e.g.
2740

2841
```
29-
terraform import tencentcloud_cam_access_key.access_key access_key_id
42+
terraform import tencentcloud_cam_access_key.example 100037718101#AKID7F******************
3043
```

tencentcloud/services/cam/resource_tc_cam_mfa_flag.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ func ResourceTencentCloudCamMfaFlag() *schema.Resource {
2727
Schema: map[string]*schema.Schema{
2828
"op_uin": {
2929
Required: true,
30+
ForceNew: true,
3031
Type: schema.TypeInt,
3132
Description: "Operate uin.",
3233
},
3334

3435
"login_flag": {
3536
Optional: true,
37+
Computed: true,
3638
Type: schema.TypeList,
3739
MaxItems: 1,
3840
Description: "Login flag setting.",
@@ -59,6 +61,7 @@ func ResourceTencentCloudCamMfaFlag() *schema.Resource {
5961

6062
"action_flag": {
6163
Optional: true,
64+
Computed: true,
6265
Type: schema.TypeList,
6366
MaxItems: 1,
6467
Description: "Action flag setting.",
@@ -122,6 +125,8 @@ func resourceTencentCloudCamMfaFlagRead(d *schema.ResourceData, meta interface{}
122125
return nil
123126
}
124127

128+
_ = d.Set("op_uin", uin)
129+
125130
if loginFlag != nil {
126131
loginFlagMap := map[string]interface{}{}
127132

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
Provides a resource to create a cam mfa_flag
1+
Provides a resource to create a CAM mfa flag
22

33
Example Usage
44

55
```hcl
6-
data "tencentcloud_user_info" "info"{}
6+
data "tencentcloud_user_info" "info" {}
77
8-
resource "tencentcloud_cam_mfa_flag" "mfa_flag" {
8+
resource "tencentcloud_cam_mfa_flag" "example" {
99
op_uin = data.tencentcloud_user_info.info.uin
10+
1011
login_flag {
11-
phone = 0
12-
stoken = 1
13-
wechat = 0
12+
phone = 0
13+
stoken = 1
14+
wechat = 0
1415
}
16+
1517
action_flag {
16-
phone = 0
17-
stoken = 1
18-
wechat = 0
18+
phone = 0
19+
stoken = 1
20+
wechat = 0
1921
}
2022
}
21-
2223
```
2324

2425
Import
2526

26-
cam mfa_flag can be imported using the id, e.g.
27+
CAM mfa flag can be imported using the id, e.g.
2728

2829
```
29-
terraform import tencentcloud_cam_mfa_flag.mfa_flag mfa_flag_id
30+
terraform import tencentcloud_cam_mfa_flag.example 100037718110
3031
```

tencentcloud/services/cam/resource_tc_cam_policy_version.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,18 @@ func resourceTencentCloudCamPolicyVersionRead(d *schema.ResourceData, meta inter
175175

176176
if policyVersion.Document != nil {
177177
policyVersionMap["document"] = policyVersion.Document
178+
_ = d.Set("policy_document", policyVersion.Document)
178179
}
179180

180181
_ = d.Set("policy_version", []interface{}{policyVersionMap})
181182

183+
if policyVersion.IsDefaultVersion != nil {
184+
if *policyVersion.IsDefaultVersion == 0 {
185+
_ = d.Set("set_as_default", false)
186+
} else {
187+
_ = d.Set("set_as_default", true)
188+
}
189+
}
182190
}
183191

184192
return nil
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
Provides a resource to create a cam policy_version
1+
Provides a resource to create a CAM policy version
22

33
Example Usage
44

55
```hcl
6-
resource "tencentcloud_cam_policy_version" "policy_version" {
7-
policy_id = 171173780
6+
resource "tencentcloud_cam_policy_version" "example" {
7+
policy_id = 171173780
8+
set_as_default = "false"
89
policy_document = jsonencode({
9-
"version": "2.0",
10-
"statement": [
10+
"version" : "3.0",
11+
"statement" : [
1112
{
12-
"effect": "allow",
13-
"action": [
13+
"effect" : "allow",
14+
"action" : [
1415
"sts:AssumeRole"
1516
],
16-
"resource": [
17+
"resource" : [
1718
"*"
1819
]
1920
},
2021
{
21-
"effect": "allow",
22-
"action": [
22+
"effect" : "allow",
23+
"action" : [
2324
"cos:PutObject"
2425
],
25-
"resource": [
26+
"resource" : [
2627
"*"
2728
]
2829
},
2930
{
30-
"effect": "deny",
31-
"action": [
31+
"effect" : "deny",
32+
"action" : [
3233
"aa:*"
3334
],
34-
"resource": [
35+
"resource" : [
3536
"*"
3637
]
3738
},
3839
{
39-
"effect": "deny",
40-
"action": [
40+
"effect" : "deny",
41+
"action" : [
4142
"aa:*"
4243
],
43-
"resource": [
44+
"resource" : [
4445
"*"
4546
]
4647
}
4748
]
4849
})
49-
set_as_default = "false"
5050
}
5151
```
5252

5353
Import
5454

55-
cam policy_version can be imported using the id, e.g.
55+
CAM policy version can be imported using the id, e.g.
5656

5757
```
58-
terraform import tencentcloud_cam_policy_version.policy_version policy_version_id
58+
terraform import tencentcloud_cam_policy_version.example 234290251#3
5959
```
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
Provides a resource to create a cam service_linked_role
1+
Provides a resource to create a CAM service linked role
22

33
Example Usage
44

55
```hcl
6-
resource "tencentcloud_cam_service_linked_role" "service_linked_role" {
7-
qcs_service_name = ["cvm.qcloud.com","ekslog.tke.cloud.tencent.com"]
8-
custom_suffix = "tf"
9-
description = "desc cam"
6+
resource "tencentcloud_cam_service_linked_role" "example" {
7+
qcs_service_name = ["cvm.qcloud.com", "ekslog.tke.cloud.tencent.com"]
8+
custom_suffix = "tf-example"
9+
description = "description."
1010
tags = {
11-
"createdBy" = "terraform"
11+
createdBy = "Terraform"
1212
}
1313
}
14+
```
1415

16+
Import
17+
18+
CAM service linked role can be imported using the id, e.g.
19+
20+
```
21+
$ terraform import tencentcloud_cam_service_linked_role.example 4611686018441982195
1522
```
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
Provides a resource to create a cam set_policy_version_config
1+
Provides a resource to create a CAM set policy version config
22

33
Example Usage
44

55
```hcl
6-
resource "tencentcloud_cam_set_policy_version_config" "set_policy_version_config" {
7-
policy_id = 171162811
8-
version_id = 2
6+
resource "tencentcloud_cam_set_policy_version_config" "example" {
7+
policy_id = 234290251
8+
version_id = 3
99
}
1010
```
1111

1212
Import
1313

14-
cam set_policy_version_config can be imported using the id, e.g.
14+
CAM set policy version config can be imported using the id, e.g.
1515

1616
```
17-
terraform import tencentcloud_cam_set_policy_version_config.set_policy_version_config set_policy_version_config_id
17+
terraform import tencentcloud_cam_set_policy_version_config.example 234290251#3
1818
```
Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1-
Provides a resource to create a cam tag_role
1+
Provides a resource to create a CAM tag role
22

33
Example Usage
44

5+
Create by role_id
6+
7+
```hcl
8+
resource "tencentcloud_cam_tag_role_attachment" "example" {
9+
role_id = "4611686018441060141"
10+
11+
tags {
12+
key = "tagKey"
13+
value = "tagValue"
14+
}
15+
}
16+
```
17+
18+
Create by role_name
19+
520
```hcl
6-
resource "tencentcloud_cam_tag_role_attachment" "tag_role" {
21+
resource "tencentcloud_cam_tag_role_attachment" "example" {
22+
role_name = "tf-example"
23+
724
tags {
8-
key = "test1"
9-
value = "test1"
25+
key = "tagKey"
26+
value = "tagValue"
1027
}
11-
role_id = "test-cam-tag"
1228
}
1329
```
1430

1531
Import
1632

17-
cam tag_role can be imported using the id, e.g.
33+
CAM tag role can be imported using the id, e.g.
1834

1935
```
20-
terraform import tencentcloud_cam_tag_role_attachment.tag_role tag_role_id
36+
# Please use role_name#role_id
37+
terraform import tencentcloud_cam_tag_role_attachment.example tf-example#4611686018441060141
2138
```
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
Provides a resource to create a cam user_permission_boundary
1+
Provides a resource to create a CAM user permission boundary
22

33
Example Usage
44

55
```hcl
6-
resource "tencentcloud_cam_user_permission_boundary_attachment" "user_permission_boundary" {
7-
target_uin = 100032767426
8-
policy_id = 151113272
6+
resource "tencentcloud_cam_user_permission_boundary_attachment" "example" {
7+
target_uin = 100037718101
8+
policy_id = 234290251
99
}
1010
```
1111

1212
Import
1313

14-
cam user_permission_boundary can be imported using the id, e.g.
14+
CAM user permission boundary can be imported using the id, e.g.
1515

1616
```
17-
terraform import tencentcloud_cam_user_permission_boundary_attachment.user_permission_boundary user_permission_boundary_id
17+
terraform import tencentcloud_cam_user_permission_boundary_attachment.example 100037718101#234290251
1818
```

0 commit comments

Comments
 (0)