Skip to content

feat(cvm): [117301871] cvm iacg v2 #2676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .changelog/2618.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_postgresql_instance: support params db_major_version create resource
```
3 changes: 3 additions & 0 deletions .changelog/2669.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/tencentcloud_cfs_file_system: fix null fs_id
```
3 changes: 3 additions & 0 deletions .changelog/2671.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_user_info: Support retry
```
3 changes: 3 additions & 0 deletions .changelog/2672.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_teo_rule_engine: Change action to Optional
```
3 changes: 3 additions & 0 deletions .changelog/2674.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cynosdb_cluster: modify tag.
```
3 changes: 3 additions & 0 deletions .changelog/2675.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_clb_instance: Support ipv6 return value `ipv6_mode` and `address_ipv6`
```
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## 1.81.101 (June 5, 2024)

ENHANCEMENTS:

* resource/tencentcloud_postgresql_instance: support params db_major_version create resource ([#2618](https://github.com/tencentcloudstack/terraform-provider-tencentcloud/pull/2618))

BUG FIXES:

* resource/tencentcloud_cfs_file_system: fix null fs_id ([#2669](https://github.com/tencentcloudstack/terraform-provider-tencentcloud/pull/2669))

## 1.81.100 (June 4, 2024)

ENHANCEMENTS:

* resource/tencentcloud_cls_index: optimize example ([#2667](https://github.com/tencentcloudstack/terraform-provider-tencentcloud/pull/2667))
* resource/tencentcloud_tdmq_rocketmq_vip_instance: support `ip_rules` params ([#2659](https://github.com/tencentcloudstack/terraform-provider-tencentcloud/pull/2659))

## 1.81.99 (May 28, 2024)

ENHANCEMENTS:
Expand Down
8 changes: 8 additions & 0 deletions tencentcloud/acctest/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"os"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -251,3 +252,10 @@ func SharedClientForRegion(region string) (interface{}, error) {

return &tcClient, nil
}

func AccStepTimeSleepDuration(d time.Duration) resource.TestCheckFunc {
return func(s *terraform.State) error {
time.Sleep(d)
return nil
}
}
48 changes: 35 additions & 13 deletions tencentcloud/services/cam/data_source_tc_user_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cam
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"log"
"math/rand"
"strconv"
Expand Down Expand Up @@ -67,9 +68,18 @@ func datasourceTencentCloudUserInfoRead(d *schema.ResourceData, meta interface{}

logId = tccommon.GetLogId(ctx)
request := cam.NewGetUserAppIdRequest()
response := cam.NewGetUserAppIdResponse()

ratelimit.Check(request.GetAction())
response, err := client.UseCamClient().GetUserAppId(request)

err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
result, e := client.UseCamClient().GetUserAppId(request)
if e != nil {
return tccommon.RetryError(e)
}
response = result
return nil
})

if err != nil {
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n",
Expand All @@ -80,25 +90,37 @@ func datasourceTencentCloudUserInfoRead(d *schema.ResourceData, meta interface{}
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",
logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())

if err != nil {
return err
}

result := response.Response

if result == nil {
if response == nil || response.Response == nil {
return fmt.Errorf("get user appid error: empty response")
}

appId := strconv.FormatUint(*result.AppId, 10)
uin := *result.Uin
ownerUin := *result.OwnerUin
var appId, uin, ownerUin string
accountInfoRequest := cam.NewDescribeSubAccountsRequest()
accountInfoResponse := cam.NewDescribeSubAccountsResponse()

if response.Response.AppId != nil {
appId = strconv.FormatUint(*response.Response.AppId, 10)
}
if response.Response.Uin != nil {
uin = *response.Response.Uin
}
if response.Response.OwnerUin != nil {
ownerUin = *response.Response.Uin
}
accountInfoRequest.FilterSubAccountUin = []*uint64{helper.Uint64(helper.StrToUInt64(uin))}
accountInfoResponse, err := client.UseCamClient().DescribeSubAccounts(accountInfoRequest)

err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
accountInfoResult, e := client.UseCamClient().DescribeSubAccounts(accountInfoRequest)
if e != nil {
return tccommon.RetryError(e)
}
accountInfoResponse = accountInfoResult
return nil
})
if err != nil {
log.Printf("[CRITAL]%s read CAM users failed, reason:%s\n", logId, err.Error())
return err
}

subAccounts := accountInfoResponse.Response.SubAccounts
var name string
if len(subAccounts) > 0 {
Expand Down
6 changes: 2 additions & 4 deletions tencentcloud/services/cam/data_source_tc_user_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ func TestAccTencentCloudDataSourceUserInfoBasic(t *testing.T) {
Providers: tcacctest.AccProviders,
Steps: []resource.TestStep{
{
PreConfig: func() { tcacctest.AccStepPreConfigSetTempAKSK(t, tcacctest.ACCOUNT_TYPE_COMMON) },
Config: testAccDataUserInfoBasic,
Config: testAccDataUserInfoBasic,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("data.tencentcloud_user_info.info", "app_id"),
resource.TestCheckResourceAttrSet("data.tencentcloud_user_info.info", "uin"),
Expand All @@ -33,8 +32,7 @@ func TestAccTencentCloudDataSourceUserInfoSubAccount(t *testing.T) {
Steps: []resource.TestStep{
{
// Need use subaccount aksk
PreConfig: func() { tcacctest.AccStepPreConfigSetTempAKSK(t, tcacctest.ACCOUNT_TYPE_SUB_ACCOUNT) },
Config: testAccDataUserInfoSubAccount,
Config: testAccDataUserInfoSubAccount,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("data.tencentcloud_user_info.info_sub_account", "app_id"),
resource.TestCheckResourceAttrSet("data.tencentcloud_user_info.info_sub_account", "uin"),
Expand Down
1 change: 1 addition & 0 deletions tencentcloud/services/cfs/resource_tc_cfs_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ func resourceTencentCloudCfsFileSystemRead(d *schema.ResourceData, meta interfac
_ = d.Set("ccn_id", mountTarget.CcnID)
_ = d.Set("cidr_block", mountTarget.CidrBlock)
_ = d.Set("net_interface", mountTarget.NetworkInterface)
_ = d.Set("fs_id", mountTarget.FSID)
}

return nil
Expand Down
12 changes: 12 additions & 0 deletions tencentcloud/services/clb/resource_tc_clb_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ func ResourceTencentCloudClbInstance() *schema.Resource {
Computed: true,
Description: "Domain name of the CLB instance.",
},
"ipv6_mode": {
Type: schema.TypeString,
Computed: true,
Description: "This field is meaningful when the IP address version is ipv6, `IPv6Nat64` | `IPv6FullChain`.",
},
"address_ipv6": {
Type: schema.TypeString,
Computed: true,
Description: "The IPv6 address of the load balancing instance.",
},
},
}
}
Expand Down Expand Up @@ -575,6 +585,8 @@ func resourceTencentCloudClbInstanceRead(d *schema.ResourceData, meta interface{
_ = d.Set("project_id", instance.ProjectId)
_ = d.Set("security_groups", helper.StringsInterfaces(instance.SecureGroups))
_ = d.Set("domain", instance.LoadBalancerDomain)
_ = d.Set("ipv6_mode", instance.IPv6Mode)
_ = d.Set("address_ipv6", instance.AddressIPv6)

if instance.SlaType != nil {
_ = d.Set("sla_type", instance.SlaType)
Expand Down
16 changes: 16 additions & 0 deletions tencentcloud/services/clb/resource_tc_clb_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ resource "tencentcloud_clb_instance" "internal_clb" {

OPEN CLB

```hcl
resource "tencentcloud_clb_instance" "open_clb" {
network_type = "OPEN"
clb_name = "myclb"
project_id = 0
vpc_id = "vpc-da7ffa61"
security_groups = ["sg-o0ek7r93"]

tags = {
test = "tf"
}
}
```

SUPPORT CORS

```hcl
resource "tencentcloud_clb_instance" "open_clb" {
network_type = "OPEN"
Expand Down
27 changes: 4 additions & 23 deletions tencentcloud/services/clb/resource_tc_clb_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,6 @@ resource "tencentcloud_clb_instance" "clb_internal" {
`

const testAccClbInstance_open = `
resource "tencentcloud_security_group" "foo" {
name = "keep-ci-temp-test-sg"
}

resource "tencentcloud_vpc" "foo" {
name = "clb-instance-open-vpc"
cidr_block = "10.0.0.0/16"
Expand All @@ -440,7 +436,7 @@ resource "tencentcloud_clb_instance" "clb_open" {
vpc_id = tencentcloud_vpc.foo.id
target_region_info_region = "ap-guangzhou"
target_region_info_vpc_id = tencentcloud_vpc.foo.id
security_groups = [tencentcloud_security_group.foo.id]
security_groups = ["sg-if748odn"]

tags = {
test = "tf"
Expand Down Expand Up @@ -509,9 +505,6 @@ resource "tencentcloud_clb_instance" "clb_internal" {
}
`
const testAccClbInstance_update_open = `
resource "tencentcloud_security_group" "foo" {
name = "clb-instance-sg"
}

resource "tencentcloud_vpc" "foo" {
name = "clb-instance-open-vpc"
Expand All @@ -525,7 +518,7 @@ resource "tencentcloud_clb_instance" "clb_open" {
project_id = 0
target_region_info_region = "ap-guangzhou"
target_region_info_vpc_id = tencentcloud_vpc.foo.id
security_groups = [tencentcloud_security_group.foo.id]
security_groups = ["sg-if748odn"]

tags = {
test = "test"
Expand All @@ -546,12 +539,6 @@ resource "tencentcloud_subnet" "subnet" {
is_multicast = false
}

resource "tencentcloud_security_group" "sglab" {
name = "clb-instance-enable-sg"
description = "favourite sg"
project_id = 0
}

resource "tencentcloud_vpc" "foo" {
name = "clb-instance-default-vpc"
cidr_block = "10.0.0.0/16"
Expand All @@ -568,7 +555,7 @@ resource "tencentcloud_clb_instance" "default_enable" {
vpc_id = tencentcloud_vpc.foo.id
load_balancer_pass_to_target = true

security_groups = [tencentcloud_security_group.sglab.id]
security_groups = ["sg-if748odn"]
target_region_info_region = "ap-guangzhou"
target_region_info_vpc_id = tencentcloud_vpc.foo.id

Expand All @@ -591,12 +578,6 @@ resource "tencentcloud_subnet" "subnet" {
is_multicast = false
}

resource "tencentcloud_security_group" "sglab" {
name = "clb-instance-enable-sg"
description = "favourite sg"
project_id = 0
}

resource "tencentcloud_vpc" "foo" {
name = "clb-instance-default-vpc"
cidr_block = "10.0.0.0/16"
Expand All @@ -613,7 +594,7 @@ resource "tencentcloud_clb_instance" "default_enable" {
vpc_id = tencentcloud_vpc.foo.id
load_balancer_pass_to_target = true

security_groups = [tencentcloud_security_group.sglab.id]
security_groups = ["sg-if748odn"]
target_region_info_region = "ap-guangzhou"
target_region_info_vpc_id = tencentcloud_vpc.foo.id

Expand Down
Loading
Loading