Skip to content

Commit 0f894b3

Browse files
authored
Fix/cfs (#2044)
* ftx/cynosdb * fix/vpc * fix/cfs * fix/cfs * fix/cfs * fix/cfs * fix/cfs
1 parent 948b12d commit 0f894b3

File tree

5 files changed

+41
-20
lines changed

5 files changed

+41
-20
lines changed

tencentcloud/resource_tc_cfs_access_group.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Provides a resource to create a CFS access group.
44
Example Usage
55
66
```hcl
7-
resource "tencentcloud_cfs_access_group" "foo" {
8-
name = "test_access_group"
9-
description = "test"
7+
resource "tencentcloud_cfs_access_group" "example" {
8+
name = "tx_example"
9+
description = "desc."
1010
}
1111
```
1212
@@ -15,7 +15,7 @@ Import
1515
CFS access group can be imported using the id, e.g.
1616
1717
```
18-
$ terraform import tencentcloud_cfs_access_group.foo pgroup-7nx89k7l
18+
$ terraform import tencentcloud_cfs_access_group.example pgroup-7nx89k7l
1919
```
2020
*/
2121
package tencentcloud
@@ -142,7 +142,8 @@ func resourceTencentCloudCfsAccessGroupUpdate(d *schema.ResourceData, meta inter
142142
if d.HasChange("description") {
143143
request.DescInfo = helper.String(d.Get("description").(string))
144144
}
145-
145+
id := d.Id()
146+
request.PGroupId = &id
146147
err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
147148
ratelimit.Check(request.GetAction())
148149
response, err := meta.(*TencentCloudClient).apiV3Conn.UseCfsClient().UpdateCfsPGroup(request)

tencentcloud/resource_tc_cfs_access_group_test.go

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ func init() {
6363
})
6464
}
6565

66-
func TestAccTencentCloudCfsAccessGroup(t *testing.T) {
66+
// go test -i; go test -test.run TestAccTencentCloudCfsAccessGroup_basic -v
67+
func TestAccTencentCloudCfsAccessGroup_basic(t *testing.T) {
6768
t.Parallel()
6869
resource.Test(t, resource.TestCase{
6970
PreCheck: func() { testAccPreCheck(t) },
@@ -73,9 +74,22 @@ func TestAccTencentCloudCfsAccessGroup(t *testing.T) {
7374
{
7475
Config: testAccCfsAccessGroup,
7576
Check: resource.ComposeTestCheckFunc(
76-
testAccCheckCfsAccessGroupExists("tencentcloud_cfs_access_group.foo"),
77-
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.foo", "name", "test_cfs_access_group"),
78-
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.foo", "description", "test"),
77+
testAccCheckCfsAccessGroupExists("tencentcloud_cfs_access_group.example"),
78+
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "name", "tx_example"),
79+
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "description", "desc."),
80+
),
81+
},
82+
{
83+
ResourceName: "tencentcloud_cfs_access_group.example",
84+
ImportState: true,
85+
ImportStateVerify: true,
86+
},
87+
{
88+
Config: testAccCfsAccessGroupUpdate,
89+
Check: resource.ComposeTestCheckFunc(
90+
testAccCheckCfsAccessGroupExists("tencentcloud_cfs_access_group.example"),
91+
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "name", "tx_example_update"),
92+
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "description", "desc update."),
7993
),
8094
},
8195
},
@@ -149,8 +163,15 @@ func testAccCheckCfsAccessGroupExists(n string) resource.TestCheckFunc {
149163
}
150164

151165
const testAccCfsAccessGroup = `
152-
resource "tencentcloud_cfs_access_group" "foo" {
153-
name = "test_cfs_access_group"
154-
description = "test"
166+
resource "tencentcloud_cfs_access_group" "example" {
167+
name = "tx_example"
168+
description = "desc."
169+
}
170+
`
171+
172+
const testAccCfsAccessGroupUpdate = `
173+
resource "tencentcloud_cfs_access_group" "example" {
174+
name = "tx_example_update"
175+
description = "desc update."
155176
}
156177
`

tencentcloud/resource_tc_cynosdb_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ func resourceTencentCloudCynosdbClusterRead(d *schema.ResourceData, meta interfa
519519
oldValue := item["old_value"].(string)
520520
currentParamItem := make(map[string]string)
521521
currentParamItem["name"] = name
522-
if currentParamMap[name] != nil {
522+
if currentParamMap[name] != nil && currentParamMap[name].CurrentValue != nil {
523523
currentParamItem["current_value"] = *currentParamMap[name].CurrentValue
524524
}
525525
if oldValue != "" {

tencentcloud/resource_tc_security_group_rule_set.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ func resourceTencentCloudSecurityGroupRuleSetUpdate(d *schema.ResourceData, m in
346346
return e
347347
}
348348

349-
if result.Egress != nil {
349+
if len(result.Egress) > 0 {
350350
tmpList := []*int64{}
351351
egressRulesList := marshalSecurityPolicy(result.Egress)
352352
for _, v := range egressRulesList {
@@ -373,14 +373,13 @@ func resourceTencentCloudSecurityGroupRuleSetUpdate(d *schema.ResourceData, m in
373373
return e
374374
}
375375

376-
if result.Ingress != nil {
376+
if len(result.Ingress) > 0 {
377377
tmpList := []*int64{}
378378
ingressRulesList := marshalSecurityPolicy(result.Ingress)
379379
for _, v := range ingressRulesList {
380380
item := v.(map[string]interface{})
381381
tmpList = append(tmpList, item["policy_index"].(*int64))
382382
}
383-
384383
e = service.DeleteSecurityGroupPolicyByPolicyIndexList(ctx, securityGroupId, tmpList, "ingress")
385384
if e != nil {
386385
return e

website/docs/r/cfs_access_group.html.markdown

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Provides a resource to create a CFS access group.
1414
## Example Usage
1515

1616
```hcl
17-
resource "tencentcloud_cfs_access_group" "foo" {
18-
name = "test_access_group"
19-
description = "test"
17+
resource "tencentcloud_cfs_access_group" "example" {
18+
name = "tx_example"
19+
description = "desc."
2020
}
2121
```
2222

@@ -40,6 +40,6 @@ In addition to all arguments above, the following attributes are exported:
4040
CFS access group can be imported using the id, e.g.
4141

4242
```
43-
$ terraform import tencentcloud_cfs_access_group.foo pgroup-7nx89k7l
43+
$ terraform import tencentcloud_cfs_access_group.example pgroup-7nx89k7l
4444
```
4545

0 commit comments

Comments
 (0)