Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e61e440
feat: test
WeiMengXS Dec 7, 2023
ff5d2d4
feat: test
WeiMengXS Dec 7, 2023
2403455
feat: test
WeiMengXS Dec 7, 2023
6481d96
feat: test
WeiMengXS Dec 7, 2023
a020a5b
feat: test
WeiMengXS Dec 7, 2023
bbe6f6c
feat: test
WeiMengXS Dec 7, 2023
92875f3
feat: test
WeiMengXS Dec 7, 2023
20d68e9
feat: test
WeiMengXS Dec 7, 2023
97e78ff
feat: test
WeiMengXS Dec 7, 2023
60f7118
feat: test
WeiMengXS Dec 7, 2023
c2c925f
feat: test
WeiMengXS Dec 7, 2023
3caa001
feat: test
WeiMengXS Dec 7, 2023
0853f1d
feat: test
WeiMengXS Dec 7, 2023
054cc5f
feat: test
WeiMengXS Dec 7, 2023
e5ab542
feat: test
WeiMengXS Dec 7, 2023
90e34cf
feat: test
WeiMengXS Dec 7, 2023
c0b648e
feat: test
WeiMengXS Dec 7, 2023
4120961
feat: test
WeiMengXS Dec 8, 2023
39d0205
feat: test
WeiMengXS Dec 8, 2023
88ee2b5
feat: test
WeiMengXS Dec 8, 2023
d69eff2
feat: fix rex
WeiMengXS Dec 8, 2023
8591fc1
feat: py update
WeiMengXS Dec 8, 2023
fcc7e8f
feat: py update
WeiMengXS Dec 8, 2023
b49b82d
feat: mark update
WeiMengXS Dec 8, 2023
9be580b
feat: mark update
WeiMengXS Dec 8, 2023
2f41b81
feat: mark update
WeiMengXS Dec 8, 2023
ff844de
feat: mark update
WeiMengXS Dec 8, 2023
2a21528
feat: mark update
WeiMengXS Dec 8, 2023
16168b1
feat: mark update
WeiMengXS Dec 8, 2023
d5461b9
feat: mark update
WeiMengXS Dec 8, 2023
263d373
feat: mark update
WeiMengXS Dec 8, 2023
0084c21
feat: mark update
WeiMengXS Dec 8, 2023
3d650c0
feat: mark update
WeiMengXS Dec 8, 2023
4095a7a
feat: mark update
WeiMengXS Dec 8, 2023
9d40b65
feat: mark update
WeiMengXS Dec 8, 2023
a316a0b
feat: mark update
WeiMengXS Dec 8, 2023
78abe49
feat: mark update
WeiMengXS Dec 8, 2023
85c10bd
feat: mark update
WeiMengXS Dec 8, 2023
955833b
feat: mark update
WeiMengXS Dec 8, 2023
6776acd
feat: mark update
WeiMengXS Dec 8, 2023
eebb397
feat: make file
WeiMengXS Dec 8, 2023
6ee0383
feat: make file
WeiMengXS Dec 8, 2023
008e3e9
feat: make file
WeiMengXS Dec 8, 2023
a74e734
Merge branch 'master' into feat/yunti-build-test
WeiMengXS Dec 8, 2023
e52d1f3
feat: update code yaml
WeiMengXS Dec 11, 2023
3f83608
Merge branch 'master' into feat/yunti-build-test
WeiMengXS Dec 11, 2023
33344ff
feat: fmt
WeiMengXS Dec 11, 2023
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
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,4 @@ changelog:
./scripts/generate-changelog.sh

.PHONY: build sweep test testacc fmt fmtcheck lint tools test-compile doc hooks website website-lint website-test

8 changes: 8 additions & 0 deletions tencentcloud/connectivity/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ import (
ssl "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss/v20180426"
)

//internal version: replace import begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace import end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.

const (
PROVIDER_CVM_REQUEST_TIMEOUT = "TENCENTCLOUD_CVM_REQUEST_TIMEOUT"
PROVIDER_CBS_REQUEST_TIMEOUT = "TENCENTCLOUD_CBS_REQUEST_TIMEOUT"
Expand Down Expand Up @@ -196,6 +199,8 @@ type TencentCloudClient struct {
trocketConn *trocket.Client
biConn *bi.Client
cdwpgConn *cdwpg.Client
//internal version: replace client begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace client end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
}

// NewClientProfile returns a new ClientProfile
Expand Down Expand Up @@ -1371,6 +1376,9 @@ func (me *TencentCloudClient) UseCdwpgClient() *cdwpg.Client {
return me.cdwpgConn
}

//internal version: replace useClient begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace useClient end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.

func getEnvDefault(key string, defVal int) int {
val, ex := os.LookupEnv(key)
if !ex {
Expand Down
3 changes: 3 additions & 0 deletions tencentcloud/internal/helper/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ func StrToBool(s string) (i bool) {
return
}

//internal version: replace boolStr begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace boolStr end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.

func StrListToStr(strList []*string) string {
res := ""
for i, v := range strList {
Expand Down
16 changes: 10 additions & 6 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ import (
)

const (
PROVIDER_SECRET_ID = "TENCENTCLOUD_SECRET_ID"
PROVIDER_SECRET_KEY = "TENCENTCLOUD_SECRET_KEY"
PROVIDER_SECURITY_TOKEN = "TENCENTCLOUD_SECURITY_TOKEN"
PROVIDER_REGION = "TENCENTCLOUD_REGION"
PROVIDER_PROTOCOL = "TENCENTCLOUD_PROTOCOL"
PROVIDER_DOMAIN = "TENCENTCLOUD_DOMAIN"
PROVIDER_SECRET_ID = "TENCENTCLOUD_SECRET_ID"
PROVIDER_SECRET_KEY = "TENCENTCLOUD_SECRET_KEY"
PROVIDER_SECURITY_TOKEN = "TENCENTCLOUD_SECURITY_TOKEN"
PROVIDER_REGION = "TENCENTCLOUD_REGION"
PROVIDER_PROTOCOL = "TENCENTCLOUD_PROTOCOL"
PROVIDER_DOMAIN = "TENCENTCLOUD_DOMAIN"
//internal version: replace envYunti begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace envYunti end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
PROVIDER_ASSUME_ROLE_ARN = "TENCENTCLOUD_ASSUME_ROLE_ARN"
PROVIDER_ASSUME_ROLE_SESSION_NAME = "TENCENTCLOUD_ASSUME_ROLE_SESSION_NAME"
PROVIDER_ASSUME_ROLE_SESSION_DURATION = "TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION"
Expand Down Expand Up @@ -85,6 +87,8 @@ func Provider() *schema.Provider {
DefaultFunc: schema.EnvDefaultFunc(PROVIDER_DOMAIN, nil),
Description: "The root domain of the API request, Default is `tencentcloudapi.com`.",
},
//internal version: replace enableBpass begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace enableBpass end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
"assume_role": {
Type: schema.TypeSet,
Optional: true,
Expand Down
19 changes: 16 additions & 3 deletions tencentcloud/resource_tc_cynosdb_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ func resourceTencentCloudCynosdbClusterCreate(d *schema.ResourceData, meta inter
cynosdbService = CynosdbService{client: client}
tagService = TagService{client: client}
region = client.Region

//internal version: replace client begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace client end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
request = cynosdb.NewCreateClustersRequest()
)

//internal version: replace varId begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace varId end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
request.ProjectId = helper.IntInt64(d.Get("project_id").(int))
request.Zone = helper.String(d.Get("available_zone").(string))
request.VpcId = helper.String(d.Get("vpc_id").(string))
Expand Down Expand Up @@ -115,7 +117,11 @@ func resourceTencentCloudCynosdbClusterCreate(d *schema.ResourceData, meta inter
}

var chargeType int64 = 0
//internal version: replace varCharge begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace varCharge end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
if v, ok := d.GetOk("charge_type"); ok {
//internal version: replace strCharge begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace strCharge end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
if v == CYNOSDB_CHARGE_TYPE_PREPAID {
chargeType = 1
if vv, ok := d.GetOk("prepaid_period"); ok {
Expand Down Expand Up @@ -143,6 +149,8 @@ func resourceTencentCloudCynosdbClusterCreate(d *schema.ResourceData, meta inter
}
}
log.Printf("[CRITAL]%s api[%s] fail, reason:%s", logId, request.GetAction(), err.Error())
//internal version: replace bpass begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace bpass end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
return retryError(err)
}
return nil
Expand Down Expand Up @@ -179,10 +187,13 @@ func resourceTencentCloudCynosdbClusterCreate(d *schema.ResourceData, meta inter
if dealRes != nil && dealRes.Response != nil && len(dealRes.Response.BillingResourceInfos) != 1 {
return fmt.Errorf("cynosdb cluster id count isn't 1")
}

//internal version: replace normal begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
id := *dealRes.Response.BillingResourceInfos[0].ClusterId
//internal version: replace normal end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
d.SetId(id)

//internal version: replace setTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace setTag end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
_, _, has, err := cynosdbService.DescribeClusterById(ctx, id)
if err != nil {
return err
Expand Down Expand Up @@ -638,6 +649,8 @@ func resourceTencentCloudCynosdbClusterUpdate(d *schema.ResourceData, meta inter
return err
}

//internal version: replace waitTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace waitTag end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
}

// update sg
Expand Down
21 changes: 19 additions & 2 deletions tencentcloud/resource_tc_elasticsearch_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ func resourceTencentCloudElasticsearchInstanceCreate(d *schema.ResourceData, met
elasticsearchService := ElasticsearchService{
client: meta.(*TencentCloudClient).apiV3Conn,
}

request := es.NewCreateInstanceRequest()

//internal version: replace var begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace var end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
request.Zone = helper.String(d.Get("availability_zone").(string))
request.EsVersion = helper.String(d.Get("version").(string))
request.VpcId = helper.String(d.Get("vpc_id").(string))
Expand All @@ -275,7 +277,9 @@ func resourceTencentCloudElasticsearchInstanceCreate(d *schema.ResourceData, met
request.InstanceName = helper.String(v.(string))
}
if v, ok := d.GetOk("charge_type"); ok {
//internal version: replace strCharge begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
chargeType := v.(string)
//internal version: replace strCharge end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
request.ChargeType = &chargeType
if chargeType == ES_CHARGE_TYPE_PREPAID {
if v, ok := d.GetOk("charge_period"); ok {
Expand Down Expand Up @@ -355,14 +359,17 @@ func resourceTencentCloudElasticsearchInstanceCreate(d *schema.ResourceData, met
request.NodeInfoList = append(request.NodeInfoList, &info)
}
}

//internal version: replace reqTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace reqTag end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
instanceId := ""
err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
ratelimit.Check(request.GetAction())
response, err := meta.(*TencentCloudClient).apiV3Conn.UseEsClient().CreateInstance(request)
if err != nil {
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n",
logId, request.GetAction(), request.ToJsonString(), err.Error())
//internal version: replace bpass begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace bpass end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
return retryError(err)
}
instanceId = *response.Response.InstanceId
Expand All @@ -373,6 +380,8 @@ func resourceTencentCloudElasticsearchInstanceCreate(d *schema.ResourceData, met
}
d.SetId(instanceId)

//internal version: replace setTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace setTag end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
instanceEmptyRetries := 5
err = resource.Retry(15*readRetryTimeout, func() *resource.RetryError {
instance, errRet := elasticsearchService.DescribeInstanceById(ctx, instanceId)
Expand Down Expand Up @@ -706,15 +715,23 @@ func resourceTencentCloudElasticsearchInstanceUpdate(d *schema.ResourceData, met
return err
}
}

if d.HasChange("tags") {
oldInterface, newInterface := d.GetChange("tags")
replaceTags, deleteTags := diffTags(oldInterface.(map[string]interface{}), newInterface.(map[string]interface{}))
tagService := TagService{
client: meta.(*TencentCloudClient).apiV3Conn,
}
region := meta.(*TencentCloudClient).apiV3Conn.Region

//internal version: replace null begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
resourceName := fmt.Sprintf("qcs::es:%s:uin/:instance/%s", region, instanceId)
err := tagService.ModifyTags(ctx, resourceName, replaceTags, deleteTags)
//internal version: replace null end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.

//internal version: replace waitTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace waitTag end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.

if err != nil {
return err
}
Expand Down
13 changes: 11 additions & 2 deletions tencentcloud/resource_tc_mongodb_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/ratelimit"
)

//internal version: replace import begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace import end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.

func resourceTencentCloudMongodbInstance() *schema.Resource {
mongodbInstanceInfo := map[string]*schema.Schema{
"standby_instance_list": {
Expand Down Expand Up @@ -218,6 +221,8 @@ func mongodbCreateInstanceByMonth(ctx context.Context, d *schema.ResourceData, m
response, err = meta.(*TencentCloudClient).apiV3Conn.UseMongodbClient().CreateDBInstance(request)
if err != nil {
log.Printf("[CRITAL]%s api[%s] fail, reason:%s", logId, request.GetAction(), err.Error())
//internal version: replace bpass begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace bpass end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
return retryError(err)
}
return nil
Expand Down Expand Up @@ -263,6 +268,8 @@ func resourceTencentCloudMongodbInstanceCreate(d *schema.ResourceData, meta inte

instanceId := d.Id()

//internal version: replace setTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace setTag end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
_, has, err := mongodbService.DescribeInstanceById(ctx, instanceId)
if err != nil {
return err
Expand All @@ -285,14 +292,16 @@ func resourceTencentCloudMongodbInstanceCreate(d *schema.ResourceData, meta inte
if !has {
return fmt.Errorf("[CRITAL]%s creating mongodb instance failed, instance doesn't exist", logId)
}

//internal version: replace begin begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace begin end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
if tags := helper.GetTags(d, "tags"); len(tags) > 0 {
resourceName := BuildTagResourceName("mongodb", "instance", region, instanceId)
if err := tagService.ModifyTags(ctx, resourceName, tags, nil); err != nil {
return err
}
}

//internal version: replace end begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
//internal version: replace end end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation.
return resourceTencentCloudMongodbInstanceRead(d, meta)
}

Expand Down
Loading