99 "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
1010)
1111
12- //go test -i; go test -test.run TestAccTencentCloudTagAttachmentResource_basic -v
12+ // go test -i; go test -test.run TestAccTencentCloudTagAttachmentResource_basic -v
1313func TestAccTencentCloudTagAttachmentResource_basic (t * testing.T ) {
1414 t .Parallel ()
1515 resource .Test (t , resource.TestCase {
@@ -25,7 +25,7 @@ func TestAccTencentCloudTagAttachmentResource_basic(t *testing.T) {
2525 testAccCheckTagAttachmentExists ("tencentcloud_tag_attachment.tag_attachment" ),
2626 resource .TestCheckResourceAttr ("tencentcloud_tag_attachment.tag_attachment" , "tag_key" , "test_terraform_tagAttachment_key" ),
2727 resource .TestCheckResourceAttr ("tencentcloud_tag_attachment.tag_attachment" , "tag_value" , "Terraform_tagAttachment_value" ),
28- resource .TestCheckResourceAttr ("tencentcloud_tag_attachment.tag_attachment" , "resource" , "qcs::cvm:ap-guangzhou:uin/100020512675:instance/ins-kfrlvcp4 " )),
28+ resource .TestCheckResourceAttrSet ("tencentcloud_tag_attachment.tag_attachment" , "resource" )),
2929 },
3030 {
3131 ResourceName : "tencentcloud_tag_attachment.tag_attachment" ,
@@ -81,12 +81,17 @@ func testAccCheckTagAttachmentExists(r string) resource.TestCheckFunc {
8181 }
8282}
8383
84- const testAccTagResourceTag = `
84+ const testAccTagResourceTag = defaultCvmModificationVariable + `
85+ data "tencentcloud_user_info" "info" {}
86+
87+ locals {
88+ uin = data.tencentcloud_user_info.info.uin
89+ }
8590
8691resource "tencentcloud_tag_attachment" "tag_attachment" {
8792 tag_key = "test_terraform_tagAttachment_key"
8893 tag_value = "Terraform_tagAttachment_value"
89- resource = "qcs::cvm:ap-guangzhou:uin/100020512675 :instance/ins-kfrlvcp4 "
94+ resource = "qcs::cvm:ap-guangzhou:uin/${local.uin} :instance/${var.cvm_id} "
9095}
9196
9297`
0 commit comments