Skip to content
Merged

Fix/cfs #2044

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions tencentcloud/resource_tc_cfs_access_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Provides a resource to create a CFS access group.
Example Usage

```hcl
resource "tencentcloud_cfs_access_group" "foo" {
name = "test_access_group"
description = "test"
resource "tencentcloud_cfs_access_group" "example" {
name = "tx_example"
description = "desc."
}
```

Expand All @@ -15,7 +15,7 @@ Import
CFS access group can be imported using the id, e.g.

```
$ terraform import tencentcloud_cfs_access_group.foo pgroup-7nx89k7l
$ terraform import tencentcloud_cfs_access_group.example pgroup-7nx89k7l
```
*/
package tencentcloud
Expand Down Expand Up @@ -142,7 +142,8 @@ func resourceTencentCloudCfsAccessGroupUpdate(d *schema.ResourceData, meta inter
if d.HasChange("description") {
request.DescInfo = helper.String(d.Get("description").(string))
}

id := d.Id()
request.PGroupId = &id
err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(request.GetAction())
response, err := meta.(*TencentCloudClient).apiV3Conn.UseCfsClient().UpdateCfsPGroup(request)
Expand Down
35 changes: 28 additions & 7 deletions tencentcloud/resource_tc_cfs_access_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ func init() {
})
}

func TestAccTencentCloudCfsAccessGroup(t *testing.T) {
// go test -i; go test -test.run TestAccTencentCloudCfsAccessGroup_basic -v
func TestAccTencentCloudCfsAccessGroup_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -73,9 +74,22 @@ func TestAccTencentCloudCfsAccessGroup(t *testing.T) {
{
Config: testAccCfsAccessGroup,
Check: resource.ComposeTestCheckFunc(
testAccCheckCfsAccessGroupExists("tencentcloud_cfs_access_group.foo"),
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.foo", "name", "test_cfs_access_group"),
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.foo", "description", "test"),
testAccCheckCfsAccessGroupExists("tencentcloud_cfs_access_group.example"),
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "name", "tx_example"),
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "description", "desc."),
),
},
{
ResourceName: "tencentcloud_cfs_access_group.example",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccCfsAccessGroupUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckCfsAccessGroupExists("tencentcloud_cfs_access_group.example"),
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "name", "tx_example_update"),
resource.TestCheckResourceAttr("tencentcloud_cfs_access_group.example", "description", "desc update."),
),
},
},
Expand Down Expand Up @@ -149,8 +163,15 @@ func testAccCheckCfsAccessGroupExists(n string) resource.TestCheckFunc {
}

const testAccCfsAccessGroup = `
resource "tencentcloud_cfs_access_group" "foo" {
name = "test_cfs_access_group"
description = "test"
resource "tencentcloud_cfs_access_group" "example" {
name = "tx_example"
description = "desc."
}
`

const testAccCfsAccessGroupUpdate = `
resource "tencentcloud_cfs_access_group" "example" {
name = "tx_example_update"
description = "desc update."
}
`
3 changes: 2 additions & 1 deletion tencentcloud/resource_tc_cls_data_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ package tencentcloud
import (
"context"
"fmt"
"log"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
cls "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016"
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
"log"
)

func resourceTencentCloudClsDataTransform() *schema.Resource {
Expand Down
5 changes: 3 additions & 2 deletions tencentcloud/resource_tc_cls_data_transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package tencentcloud
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

// go test -i; go test -test.run TestAccTencentCloudClsDataTransformResource_basic -v
Expand Down
5 changes: 3 additions & 2 deletions tencentcloud/resource_tc_cls_kafka_recharge.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ package tencentcloud
import (
"context"
"fmt"
"log"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
cls "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016"
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
"log"
"strings"
)

func resourceTencentCloudClsKafkaRecharge() *schema.Resource {
Expand Down
5 changes: 3 additions & 2 deletions tencentcloud/resource_tc_cls_kafka_recharge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package tencentcloud
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccTencentCloudClsKafkaRechargeResource_basic(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions tencentcloud/resource_tc_cls_scheduled_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ package tencentcloud
import (
"context"
"fmt"
"log"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
cls "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016"
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
"log"
"time"
)

func resourceTencentCloudClsScheduledSql() *schema.Resource {
Expand Down
3 changes: 2 additions & 1 deletion tencentcloud/resource_tc_cls_scheduled_sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package tencentcloud
import (
"context"
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"testing"
)

// go test -i; go test -test.run TestAccTencentCloudClsScheduledSqlResource_basic -v
Expand Down
2 changes: 1 addition & 1 deletion tencentcloud/resource_tc_cynosdb_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func resourceTencentCloudCynosdbClusterRead(d *schema.ResourceData, meta interfa
oldValue := item["old_value"].(string)
currentParamItem := make(map[string]string)
currentParamItem["name"] = name
if currentParamMap[name] != nil {
if currentParamMap[name] != nil && currentParamMap[name].CurrentValue != nil {
currentParamItem["current_value"] = *currentParamMap[name].CurrentValue
}
if oldValue != "" {
Expand Down
5 changes: 2 additions & 3 deletions tencentcloud/resource_tc_security_group_rule_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func resourceTencentCloudSecurityGroupRuleSetUpdate(d *schema.ResourceData, m in
return e
}

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

if result.Ingress != nil {
if len(result.Ingress) > 0 {
tmpList := []*int64{}
ingressRulesList := marshalSecurityPolicy(result.Ingress)
for _, v := range ingressRulesList {
item := v.(map[string]interface{})
tmpList = append(tmpList, item["policy_index"].(*int64))
}

e = service.DeleteSecurityGroupPolicyByPolicyIndexList(ctx, securityGroupId, tmpList, "ingress")
if e != nil {
return e
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/cfs_access_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Provides a resource to create a CFS access group.
## Example Usage

```hcl
resource "tencentcloud_cfs_access_group" "foo" {
name = "test_access_group"
description = "test"
resource "tencentcloud_cfs_access_group" "example" {
name = "tx_example"
description = "desc."
}
```

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

```
$ terraform import tencentcloud_cfs_access_group.foo pgroup-7nx89k7l
$ terraform import tencentcloud_cfs_access_group.example pgroup-7nx89k7l
```