Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6c75a8f
refactor: migrate package tencentcloud/services/cam
yhlooo Dec 19, 2023
1f55d09
refactor: migrate package tencentcloud/services/cat
yhlooo Dec 19, 2023
7a553bd
refactor: migrate package tencentcloud/services/cbs
yhlooo Dec 19, 2023
7dfe2ca
refactor: migrate package tencentcloud/services/ccn
yhlooo Dec 19, 2023
8946830
refactor: migrate package tencentcloud/services/cdh
yhlooo Dec 19, 2023
6176888
fix: replace tccommon. tcacctest. in string
yhlooo Dec 19, 2023
5a6147c
refactor: migrate package tencentcloud/services/cdb
yhlooo Dec 19, 2023
ac01f33
refactor: migrate package tencentcloud/services/cdn
yhlooo Dec 20, 2023
ed9576b
refactor: migrate package tencentcloud/services/cdwch
yhlooo Dec 20, 2023
e5c92b0
refactor: migrate package tencentcloud/services/cdwpg
yhlooo Dec 20, 2023
9cfd6e9
refactor: migrate package tencentcloud/services/cfs
yhlooo Dec 20, 2023
8981e2e
refactor: migrate package tencentcloud/services/cfw
yhlooo Dec 20, 2023
033c08e
refactor: migrate package tencentcloud/services/chdfs
yhlooo Dec 20, 2023
1c3084c
refactor: migrate package tencentcloud/services/ci
yhlooo Dec 20, 2023
9794285
refactor: migrate package tencentcloud/services/ciam
yhlooo Dec 20, 2023
f2fa817
refactor: migrate package tencentcloud/services/ckafka
yhlooo Dec 20, 2023
2749a1b
refactor: migrate package tencentcloud/services/clb
yhlooo Dec 20, 2023
298e256
chore: remove unused code
yhlooo Dec 20, 2023
c86c5d3
refactor: migrate package tencentcloud/services/cls
yhlooo Dec 20, 2023
5f5e788
refactor: migrate package tencentcloud/services/common
yhlooo Dec 20, 2023
47ecee7
refactor: migrate package tencentcloud/services/cos
yhlooo Dec 20, 2023
6585837
refactor: migrate package tencentcloud/services/crs
yhlooo Dec 20, 2023
4558839
refactor: migrate package tencentcloud/services/css
yhlooo Dec 20, 2023
e90d376
refactor: migrate package tencentcloud/services/cwp
yhlooo Dec 20, 2023
6278d4b
refactor: migrate package tencentcloud/services/cvm
yhlooo Dec 20, 2023
40f166b
refactor: migrate package tencentcloud/services/cynosdb
yhlooo Dec 20, 2023
0602db7
refactor: migrate package tencentcloud/services/apigateway
yhlooo Dec 20, 2023
6d49b0c
refactor: migrate package tencentcloud/services/as
yhlooo Dec 20, 2023
6ce1fd8
refactor: migrate package tencentcloud/services/audit
yhlooo Dec 20, 2023
48d24b7
fix: replace tccommon. tcacctest. in string
yhlooo Dec 20, 2023
eefb1a3
style: fmt
yhlooo Dec 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 45 additions & 0 deletions tencentcloud/acctest/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"

tcprovider "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud"
providercommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/connectivity"
)

Expand Down Expand Up @@ -206,3 +208,46 @@ func AccPreCheckBusiness(t *testing.T, accountType string) {
AccPreCheck(t)
}
}

type TencentCloudClient struct {
apiV3Conn *connectivity.TencentCloudClient
}

var _ providercommon.ProviderMeta = &TencentCloudClient{}

// GetAPIV3Conn 返回访问云 API 的客户端连接对象
func (meta *TencentCloudClient) GetAPIV3Conn() *connectivity.TencentCloudClient {
return meta.apiV3Conn
}

func SharedClientForRegion(region string) (interface{}, error) {
var secretId string
if secretId = os.Getenv(tcprovider.PROVIDER_SECRET_ID); secretId == "" {
return nil, fmt.Errorf("%s can not be empty", tcprovider.PROVIDER_SECRET_ID)
}

var secretKey string
if secretKey = os.Getenv(tcprovider.PROVIDER_SECRET_KEY); secretKey == "" {
return nil, fmt.Errorf("%s can not be empty", tcprovider.PROVIDER_SECRET_KEY)
}

securityToken := os.Getenv(tcprovider.PROVIDER_SECURITY_TOKEN)
protocol := os.Getenv(tcprovider.PROVIDER_PROTOCOL)
domain := os.Getenv(tcprovider.PROVIDER_DOMAIN)

client := &connectivity.TencentCloudClient{
Credential: common.NewTokenCredential(
secretId,
secretKey,
securityToken,
),
Region: region,
Protocol: protocol,
Domain: domain,
}

var tcClient TencentCloudClient
tcClient.apiV3Conn = client

return &tcClient, nil
}
27 changes: 0 additions & 27 deletions tencentcloud/data_source_tc_clickhouse_backup_tables_test.go

This file was deleted.

25 changes: 25 additions & 0 deletions tencentcloud/data_source_tc_postgresql_instances_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package tencentcloud

import (
"context"
"fmt"
"testing"

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

tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
)

var testDataPostgresqlInstancesName = "data.tencentcloud_postgresql_instances.id_test"
Expand Down Expand Up @@ -43,6 +48,26 @@ func TestAccTencentCloudPostgresqlInstancesDataSource(t *testing.T) {
})
}

func testAccCheckLBDestroy(s *terraform.State) error {
logId := tccommon.GetLogId(tccommon.ContextNil)
ctx := context.WithValue(context.TODO(), tccommon.LogIdKey, logId)

clbService := ClbService{
client: testAccProvider.Meta().(tccommon.ProviderMeta).GetAPIV3Conn(),
}
for _, rs := range s.RootModule().Resources {
if rs.Type != "tencentcloud_lb" {
continue
}

_, err := clbService.DescribeLoadBalancerById(ctx, rs.Primary.ID)
if err == nil {
return fmt.Errorf("clb instance still exists: %s", rs.Primary.ID)
}
}
return nil
}

const testAccTencentCloudDataPostgresqlInstanceBasic = CommonPresetPGSQL + `

data "tencentcloud_postgresql_instances" "id_test"{
Expand Down
1,131 changes: 579 additions & 552 deletions tencentcloud/provider.go

Large diffs are not rendered by default.

35 changes: 0 additions & 35 deletions tencentcloud/resource_tc_clb_replace_cert_for_lbs_test.go

This file was deleted.

188 changes: 0 additions & 188 deletions tencentcloud/resource_tc_mysql_switch_proxy.go

This file was deleted.

Loading