@@ -60,7 +60,7 @@ func TestAccComputeDisk_updateSize(t *testing.T) {
60
60
})
61
61
}
62
62
63
- func TestAccComputeDisk_fromSnapshotURI (t * testing.T ) {
63
+ func TestAccComputeDisk_fromSnapshot (t * testing.T ) {
64
64
diskName := fmt .Sprintf ("tf-test-%s" , acctest .RandString (10 ))
65
65
firstDiskName := fmt .Sprintf ("tf-test-%s" , acctest .RandString (10 ))
66
66
snapshotName := fmt .Sprintf ("tf-test-%s" , acctest .RandString (10 ))
@@ -74,7 +74,14 @@ func TestAccComputeDisk_fromSnapshotURI(t *testing.T) {
74
74
CheckDestroy : testAccCheckComputeDiskDestroy ,
75
75
Steps : []resource.TestStep {
76
76
resource.TestStep {
77
- Config : testAccComputeDisk_fromSnapshotURI (firstDiskName , snapshotName , diskName , xpn_host ),
77
+ Config : testAccComputeDisk_fromSnapshot (firstDiskName , snapshotName , diskName , xpn_host , "self_link" ),
78
+ Check : resource .ComposeTestCheckFunc (
79
+ testAccCheckComputeDiskExists (
80
+ "google_compute_disk.seconddisk" , & disk ),
81
+ ),
82
+ },
83
+ resource.TestStep {
84
+ Config : testAccComputeDisk_fromSnapshot (firstDiskName , snapshotName , diskName , xpn_host , "name" ),
78
85
Check : resource .ComposeTestCheckFunc (
79
86
testAccCheckComputeDiskExists (
80
87
"google_compute_disk.seconddisk" , & disk ),
@@ -251,7 +258,7 @@ resource "google_compute_disk" "foobar" {
251
258
}` , diskName )
252
259
}
253
260
254
- func testAccComputeDisk_fromSnapshotURI (firstDiskName , snapshotName , diskName , xpn_host string ) string {
261
+ func testAccComputeDisk_fromSnapshot (firstDiskName , snapshotName , diskName , xpn_host string , ref_selector string ) string {
255
262
return fmt .Sprintf (`
256
263
resource "google_compute_disk" "foobar" {
257
264
name = "%s"
@@ -270,10 +277,10 @@ resource "google_compute_snapshot" "snapdisk" {
270
277
}
271
278
resource "google_compute_disk" "seconddisk" {
272
279
name = "%s"
273
- snapshot = "${google_compute_snapshot.snapdisk.self_link }"
280
+ snapshot = "${google_compute_snapshot.snapdisk.%s }"
274
281
type = "pd-ssd"
275
282
zone = "us-central1-a"
276
- }` , firstDiskName , xpn_host , snapshotName , xpn_host , diskName )
283
+ }` , firstDiskName , xpn_host , snapshotName , xpn_host , diskName , ref_selector )
277
284
}
278
285
279
286
func testAccComputeDisk_encryption (diskName string ) string {
0 commit comments