diff --git a/GNUmakefile b/GNUmakefile index b74fe3138a..97bd4b5fa5 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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 + diff --git a/tencentcloud/connectivity/client.go b/tencentcloud/connectivity/client.go index 960a95b363..1d63b4d15d 100644 --- a/tencentcloud/connectivity/client.go +++ b/tencentcloud/connectivity/client.go @@ -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" @@ -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 @@ -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 { diff --git a/tencentcloud/internal/helper/transform.go b/tencentcloud/internal/helper/transform.go index d895c68526..bec3864562 100644 --- a/tencentcloud/internal/helper/transform.go +++ b/tencentcloud/internal/helper/transform.go @@ -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 { diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index fb0816977a..0ec7f115d6 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -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" @@ -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, diff --git a/tencentcloud/resource_tc_cynosdb_cluster.go b/tencentcloud/resource_tc_cynosdb_cluster.go index 3df6b57e3a..fb6ef6c174 100644 --- a/tencentcloud/resource_tc_cynosdb_cluster.go +++ b/tencentcloud/resource_tc_cynosdb_cluster.go @@ -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)) @@ -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 { @@ -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 @@ -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 @@ -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 diff --git a/tencentcloud/resource_tc_elasticsearch_instance.go b/tencentcloud/resource_tc_elasticsearch_instance.go index 42528639f8..c97dc84359 100755 --- a/tencentcloud/resource_tc_elasticsearch_instance.go +++ b/tencentcloud/resource_tc_elasticsearch_instance.go @@ -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)) @@ -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 { @@ -355,7 +359,8 @@ 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()) @@ -363,6 +368,8 @@ func resourceTencentCloudElasticsearchInstanceCreate(d *schema.ResourceData, met 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 @@ -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) @@ -706,6 +715,7 @@ 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{})) @@ -713,8 +723,15 @@ func resourceTencentCloudElasticsearchInstanceUpdate(d *schema.ResourceData, met 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 } diff --git a/tencentcloud/resource_tc_mongodb_instance.go b/tencentcloud/resource_tc_mongodb_instance.go index f091a1f1bc..c48bfd9b64 100644 --- a/tencentcloud/resource_tc_mongodb_instance.go +++ b/tencentcloud/resource_tc_mongodb_instance.go @@ -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": { @@ -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 @@ -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 @@ -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) } diff --git a/tencentcloud/resource_tc_mysql_instance.go b/tencentcloud/resource_tc_mysql_instance.go index a493273500..2a3c20d940 100644 --- a/tencentcloud/resource_tc_mysql_instance.go +++ b/tencentcloud/resource_tc_mysql_instance.go @@ -520,6 +520,8 @@ func mysqlCreateInstancePayByMonth(ctx context.Context, d *schema.ResourceData, request := cdb.NewCreateDBInstanceRequest() clientToken := helper.BuildToken() request.ClientToken = &clientToken + //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. payType, oldOk := d.GetOkExists("pay_type") var period int @@ -548,6 +550,8 @@ func mysqlCreateInstancePayByMonth(ctx context.Context, d *schema.ResourceData, if inErr != nil { log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), inErr.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(inErr) } @@ -556,7 +560,8 @@ func mysqlCreateInstancePayByMonth(ctx context.Context, d *schema.ResourceData, } response = r - + //internal version: replace instanceId 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 instanceId end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. return nil }) @@ -568,7 +573,9 @@ func mysqlCreateInstancePayByMonth(ctx context.Context, d *schema.ResourceData, if len(response.Response.InstanceIds) != 1 { return fmt.Errorf("mysql CreateDBInstance return len(InstanceIds) is not 1,but %d", len(response.Response.InstanceIds)) } + //internal version: replace setId begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. d.SetId(*response.Response.InstanceIds[0]) + //internal version: replace setId end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. return nil } @@ -626,7 +633,9 @@ func resourceTencentCloudMysqlInstanceCreate(d *schema.ResourceData, meta interf logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) + //internal version: replace mysqlServer begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. mysqlService := MysqlService{client: meta.(*TencentCloudClient).apiV3Conn} + //internal version: replace mysqlServer end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. payType := getPayType(d).(int) @@ -646,6 +655,7 @@ func resourceTencentCloudMysqlInstanceCreate(d *schema.ResourceData, meta interf mysqlID := 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. if tags := helper.GetTags(d, "tags"); len(tags) > 0 { tcClient := meta.(*TencentCloudClient).apiV3Conn tagService := &TagService{client: tcClient} @@ -654,7 +664,7 @@ func resourceTencentCloudMysqlInstanceCreate(d *schema.ResourceData, meta interf return err } } - + //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. err := resource.Retry(7*readRetryTimeout, func() *resource.RetryError { mysqlInfo, err := mysqlService.DescribeDBInstanceById(ctx, mysqlID) if err != nil { @@ -1158,7 +1168,8 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met if err != nil { 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. } if d.HasChange("param_template_id") { diff --git a/tencentcloud/resource_tc_postgresql_instance.go b/tencentcloud/resource_tc_postgresql_instance.go index fa634225b9..995fe85258 100644 --- a/tencentcloud/resource_tc_postgresql_instance.go +++ b/tencentcloud/resource_tc_postgresql_instance.go @@ -303,13 +303,16 @@ func resourceTencentCloudPostgresqlInstanceCreate(d *schema.ResourceData, meta i logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) - + //internal version: replace clientCreate begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. postgresqlService := PostgresqlService{client: meta.(*TencentCloudClient).apiV3Conn} + //internal version: replace clientCreate end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. var ( - name = d.Get("name").(string) - dbVersion = d.Get("engine_version").(string) - payType = d.Get("charge_type").(string) + name = d.Get("name").(string) + dbVersion = d.Get("engine_version").(string) + payType = d.Get("charge_type").(string) + //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. projectId = d.Get("project_id").(int) subnetId = d.Get("subnet_id").(string) vpcId = d.Get("vpc_id").(string) @@ -465,6 +468,8 @@ func resourceTencentCloudPostgresqlInstanceCreate(d *schema.ResourceData, meta i voucherIds, ) if inErr != nil { + //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(inErr) } return nil @@ -475,6 +480,9 @@ func resourceTencentCloudPostgresqlInstanceCreate(d *schema.ResourceData, meta i 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. + // check creation done err := resource.Retry(20*readRetryTimeout, func() *resource.RetryError { instance, has, err := postgresqlService.DescribePostgresqlInstanceById(ctx, instanceId) @@ -544,6 +552,7 @@ func resourceTencentCloudPostgresqlInstanceCreate(d *schema.ResourceData, meta i return checkErr } + //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. if tags := helper.GetTags(d, "tags"); len(tags) > 0 { tcClient := meta.(*TencentCloudClient).apiV3Conn tagService := &TagService{client: tcClient} @@ -552,6 +561,7 @@ func resourceTencentCloudPostgresqlInstanceCreate(d *schema.ResourceData, meta i return err } } + //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. // set pg params paramEntrys := make(map[string]string) @@ -614,8 +624,9 @@ func resourceTencentCloudPostgresqlInstanceUpdate(d *schema.ResourceData, meta i logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) - + //internal version: replace clientUpdate begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. postgresqlService := PostgresqlService{client: meta.(*TencentCloudClient).apiV3Conn} + //internal version: replace clientUpdate end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. instanceId := d.Id() d.Partial(true) @@ -1060,14 +1071,17 @@ func resourceTencentCloudPostgresqlInstanceUpdate(d *schema.ResourceData, meta i oldValue, newValue := d.GetChange("tags") replaceTags, deleteTags := diffTags(oldValue.(map[string]interface{}), newValue.(map[string]interface{})) + //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. tcClient := meta.(*TencentCloudClient).apiV3Conn tagService := &TagService{client: tcClient} + //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. resourceName := BuildTagResourceName("postgres", "DBInstanceId", tcClient.Region, d.Id()) err := tagService.ModifyTags(ctx, resourceName, replaceTags, deleteTags) if err != nil { 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. } paramEntrys := make(map[string]string) if d.HasChange("max_standby_archive_delay") { diff --git a/tencentcloud/resource_tc_redis_instance.go b/tencentcloud/resource_tc_redis_instance.go index 92d3b0e2f6..0de41c756f 100644 --- a/tencentcloud/resource_tc_redis_instance.go +++ b/tencentcloud/resource_tc_redis_instance.go @@ -15,6 +15,9 @@ import ( "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" ) +//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 resourceTencentCloudRedisInstance() *schema.Resource { types := []string{} for _, v := range REDIS_NAMES { @@ -176,8 +179,10 @@ func resourceTencentCloudRedisInstance() *schema.Resource { }, "tags": { - Type: schema.TypeMap, - Optional: true, + Type: schema.TypeMap, + Optional: true, + //internal version: replace tagComputed 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 tagComputed end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. Description: "Instance tags.", }, @@ -257,6 +262,8 @@ func resourceTencentCloudRedisInstanceCreate(d *schema.ResourceData, meta interf client := meta.(*TencentCloudClient).apiV3Conn redisService := RedisService{client: client} tagService := TagService{client: client} + //internal version: replace clientCreate 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 clientCreate end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. region := client.Region availabilityZone := d.Get("availability_zone").(string) @@ -381,13 +388,17 @@ func resourceTencentCloudRedisInstanceCreate(d *schema.ResourceData, meta interf requestSecurityGroup = append(requestSecurityGroup, v.(string)) } + //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. service := RedisService{client: meta.(*TencentCloudClient).apiV3Conn} + //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. nodeInfo := make([]*redis.RedisNodeInfo, 0) if raw, ok := d.GetOk("replica_zone_ids"); ok { zoneIds := raw.([]interface{}) - + //internal version: replace redisServer begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. masterZoneId, err := service.getZoneId(availabilityZone) + //internal version: replace redisServer 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 } @@ -428,15 +439,26 @@ func resourceTencentCloudRedisInstanceCreate(d *schema.ResourceData, meta interf replicasReadonly, paramsTemplateId, ) - + //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. if err != nil { + //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. return err + //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. } if len(instanceIds) == 0 { return fmt.Errorf("redis api CreateInstances return empty redis id") } + + //internal version: replace getId begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. var redisId = *instanceIds[0] + //internal version: replace getId 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 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. + + //internal version: replace queryAndSetId begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. _, _, _, err = redisService.CheckRedisOnlineOk(ctx, redisId, 20*readRetryTimeout) if err != nil { @@ -444,13 +466,16 @@ func resourceTencentCloudRedisInstanceCreate(d *schema.ResourceData, meta interf return err } d.SetId(redisId) + //internal version: replace queryAndSetId 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 null begin, 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("redis", "instance", region, d.Id()) if err := tagService.ModifyTags(ctx, resourceName, tags, nil); err != nil { return err } } + //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. return resourceTencentCloudRedisInstanceRead(d, meta) } @@ -461,8 +486,10 @@ func resourceTencentCloudRedisInstanceRead(d *schema.ResourceData, meta interfac logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) - + //internal version: replace clientRead begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. service := RedisService{client: meta.(*TencentCloudClient).apiV3Conn} + //internal version: replace clientRead end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. + var onlineHas = true var ( has bool @@ -489,7 +516,9 @@ func resourceTencentCloudRedisInstanceRead(d *schema.ResourceData, meta interfac return nil }) if err != nil { + //internal version: replace redisFail begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. return fmt.Errorf("Fail to get info from redis, reaseon %s", err.Error()) + //internal version: replace redisFail end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. } if !onlineHas { return nil @@ -586,10 +615,12 @@ func resourceTencentCloudRedisInstanceRead(d *schema.ResourceData, meta interfac _ = d.Set("replica_zone_ids", zoneIds) } } - + //internal version: replace resourceTag begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. tcClient := meta.(*TencentCloudClient).apiV3Conn tagService := &TagService{client: tcClient} tags, err := tagService.DescribeResourceTags(ctx, "redis", "instance", tcClient.Region, d.Id()) + //internal version: replace resourceTag 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 } @@ -892,11 +923,15 @@ func resourceTencentCloudRedisInstanceUpdate(d *schema.ResourceData, meta interf if d.HasChange("tags") { oldTags, newTags := d.GetChange("tags") replaceTags, deleteTags := diffTags(oldTags.(map[string]interface{}), newTags.(map[string]interface{})) - + //internal version: replace setTagUpdate begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. resourceName := BuildTagResourceName("redis", "instance", region, id) + //internal version: replace setTagUpdate end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. if err := tagService.ModifyTags(ctx, resourceName, replaceTags, deleteTags); err != nil { 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. } d.Partial(false) diff --git a/tencentcloud/resource_tc_tdmq_instance.go b/tencentcloud/resource_tc_tdmq_instance.go index ae33ce3614..28d01cabe3 100644 --- a/tencentcloud/resource_tc_tdmq_instance.go +++ b/tencentcloud/resource_tc_tdmq_instance.go @@ -52,6 +52,9 @@ func resourceTencentCloudTdmqCreate(d *schema.ResourceData, meta interface{}) er logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) + //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. + var ( request = tdmq.NewCreateClusterRequest() response *tdmq.CreateClusterResponse @@ -88,12 +91,18 @@ func resourceTencentCloudTdmqCreate(d *schema.ResourceData, meta interface{}) er clusterId := *response.Response.ClusterId if tags := helper.GetTags(d, "tags"); len(tags) > 0 { + //internal version: replace buildName begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. tagService := TagService{client: meta.(*TencentCloudClient).apiV3Conn} region := meta.(*TencentCloudClient).apiV3Conn.Region resourceName := fmt.Sprintf("qcs::tdmq:%s:uin/:cluster/%s", region, clusterId) + //internal version: replace buildName end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. + if err := tagService.ModifyTags(ctx, resourceName, tags, nil); err != nil { 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. } d.SetId(clusterId) @@ -151,6 +160,9 @@ func resourceTencentCloudTdmqUpdate(d *schema.ResourceData, meta interface{}) er service := TdmqService{client: meta.(*TencentCloudClient).apiV3Conn} + //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. + var ( clusterName string remark string @@ -174,6 +186,7 @@ func resourceTencentCloudTdmqUpdate(d *schema.ResourceData, meta interface{}) er } if d.HasChange("tags") { + //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. tcClient := meta.(*TencentCloudClient).apiV3Conn tagService := &TagService{client: tcClient} oldTags, newTags := d.GetChange("tags") @@ -182,6 +195,7 @@ func resourceTencentCloudTdmqUpdate(d *schema.ResourceData, meta interface{}) er if err := tagService.ModifyTags(ctx, resourceName, replaceTags, deleteTags); err != nil { return err } + //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. } return resourceTencentCloudTdmqRead(d, meta) } diff --git a/tencentcloud/service_tencentcloud_tag.go b/tencentcloud/service_tencentcloud_tag.go index e6faa75ded..281b6ed9b5 100644 --- a/tencentcloud/service_tencentcloud_tag.go +++ b/tencentcloud/service_tencentcloud_tag.go @@ -12,6 +12,9 @@ import ( "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/ratelimit" ) +//internal version: replace tagFmt 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 tagFmt end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. + type TagService struct { client *connectivity.TencentCloudClient } @@ -102,6 +105,9 @@ func (me *TagService) DescribeResourceTags(ctx context.Context, serviceType, res return } +//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. + func diffTags(oldTags, newTags map[string]interface{}) (replaceTags map[string]string, deleteTags []string) { replaceTags = make(map[string]string) deleteTags = make([]string, 0)