@@ -53,7 +53,7 @@ func TestAccTencentCloudImageResource(t *testing.T) {
5353 Check : resource .ComposeTestCheckFunc (
5454 testAccCheckImageExists (ImageInstance ),
5555 resource .TestCheckResourceAttr (ImageInstance , "image_name" , "image-instance-keep" ),
56- resource .TestCheckResourceAttr (ImageInstance , "instance_id" , "ins-fodds4y2" ),
56+ resource .TestCheckResourceAttr (ImageInstance , "instance_id" , defaultCvmId ),
5757 resource .TestCheckResourceAttr (ImageInstance , "data_disk_ids.#" , "1" ),
5858 resource .TestCheckResourceAttr (ImageInstance , "image_description" , "create image with instance" ),
5959 ),
@@ -62,7 +62,7 @@ func TestAccTencentCloudImageResource(t *testing.T) {
6262 Config : testAccImageWithInstanceUpdate ,
6363 Check : resource .ComposeAggregateTestCheckFunc (
6464 resource .TestCheckResourceAttr (ImageInstance , "image_name" , "image-instance-update-keep" ),
65- resource .TestCheckResourceAttr (ImageInstance , "instance_id" , "ins-fodds4y2" ),
65+ resource .TestCheckResourceAttr (ImageInstance , "instance_id" , defaultCvmId ),
6666 resource .TestCheckResourceAttr (ImageInstance , "data_disk_ids.#" , "1" ),
6767 resource .TestCheckResourceAttr (ImageInstance , "image_description" , "update image with instance" ),
6868 ),
@@ -134,35 +134,35 @@ func testAccCheckImageExists(n string) resource.TestCheckFunc {
134134}
135135
136136const (
137- testAccImageWithSnapShot = `
137+ testAccImageWithSnapShot = defaultCvmImageVariable + `
138138 resource "tencentcloud_image" "image_snap" {
139139 image_name = "image-snapshot-keep"
140- snapshot_ids = ["snap-8f2updnb" ]
140+ snapshot_ids = [var.snap_id ]
141141 force_poweroff = true
142142 image_description = "create image with snapshot"
143143 }`
144144
145- testAccImageWithSnapShotUpdate = `
145+ testAccImageWithSnapShotUpdate = defaultCvmImageVariable + `
146146 resource "tencentcloud_image" "image_snap" {
147147 image_name = "image-snapshot-update-keep"
148- snapshot_ids = ["snap-8f2updnb" ]
148+ snapshot_ids = [var.snap_id ]
149149 force_poweroff = false
150150 image_description = "update image with snapshot"
151151 }`
152152
153- testAccImageWithInstance = `
153+ testAccImageWithInstance = defaultCvmImageVariable + `
154154 resource "tencentcloud_image" "image_instance" {
155155 image_name = "image-instance-keep"
156- instance_id = "ins-fodds4y2"
157- data_disk_ids = ["disk-mrnskm5i" ]
156+ instance_id = var.cvm_id
157+ data_disk_ids = [var.disk_id ]
158158 image_description = "create image with instance"
159159 }`
160160
161- testAccImageWithInstanceUpdate = `
161+ testAccImageWithInstanceUpdate = defaultCvmImageVariable + `
162162 resource "tencentcloud_image" "image_instance" {
163163 image_name = "image-instance-update-keep"
164- instance_id = "ins-fodds4y2"
165- data_disk_ids = ["disk-mrnskm5i" ]
164+ instance_id = var.cvm_id
165+ data_disk_ids = [var.disk_id ]
166166 image_description = "update image with instance"
167167 }`
168168)
0 commit comments