Skip to content

Commit 8d071cd

Browse files
authored
Merge pull request #2000 from tencentcloudstack/fix/tag_attachment_test
fix tag attachment test
2 parents 3afc14c + 920b4ce commit 8d071cd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tencentcloud/resource_tc_tag_attachment_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
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
1313
func 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
8691
resource "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

Comments
 (0)