key:values. It can be associated with most of your Tencent Cloud resources, greatly simplifying resource categorization, search, and aggregation.In Terraform, a resource tag is defined through Map:resource "tencentcloud_instance" "cvm" {tags = {key1: "val1",key2: "val2"}}
CreateAPI parameter:rsType := "instance"request := cvm.NewRunInstanceRequest()request.TagSpecification = append(request.TagSpecification, &cvm.TagSpecification{ResourceType: &rsType,Tags: []*cvm.Tag{{Key: &key,Value: &value,},},})
qcs:<project_id, which is left empty here>:<Module>:<Region>:<Account/UIN>:<Resource/ID>
qcs::vpc:ap-singapore:uin/:vpc/vpc-xxxxxxxx
ModifyTags:package mainfunc ResourceTencentCloudVPCUpdate(d *schema.ResourceData, meta interface{}) {ctx := context.TODO()region := meta.(*TencentCloudClient).apiV3Conn.Regionid := d.Id()resourceName := fmt.Sprintf("qcs::vpc:%s:uin/:vpc/%s", region, id)replaceTags, deleteTags := diffTags(oldTags.(map[string]interface{}), newTags.(map[string]interface{}))if err := tagService.ModifyTags(ctx, resourceName, replaceTags, deleteTags); err != nil {return err}}
Feedback