产品概述
产品优势
应用场景
key:values 的形式存在,用来关联您的绝大部分云资源,对于资源的分类、搜索和聚合十分有用。在 Terraform 中,通过 Map 来定义一个资源的 Tag:resource "tencentcloud_instance" "cvm" {tags = {key1: "val1",key2: "val2"}}
rsType := "instance"request := cvm.NewRunInstanceRequest()request.TagSpecification = append(request.TagSpecification, &cvm.TagSpecification{ResourceType: &rsType,Tags: []*cvm.Tag{{Key: &key,Value: &value,},},})
qcs:<project_id,此处置空>:<模块>:<地域>:<账号/uin>:<资源/ID>
qcs::vpc:ap-singapore:uin/:vpc/vpc-xxxxxxxx
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}}
文档反馈