@@ -131,44 +131,41 @@ func TestAccImage_ExternalBlockVolume(t *testing.T) {
131131 size_in_gb = 50
132132 iops = 5000
133133 }
134-
135- resource "scaleway_block_snapshot" "main" {
136- volume_id = scaleway_block_volume.main.id
137- }
138- ` ,
139- },
140- {
141- Config : `
142- resource "scaleway_block_volume" "main" {
134+ resource "scaleway_block_volume" "additional1" {
143135 size_in_gb = 50
144136 iops = 5000
145137 }
146-
147- resource "scaleway_block_volume" "additional1" {
138+ resource "scaleway_block_volume" "additional2" {
148139 size_in_gb = 50
149140 iops = 5000
150141 }
151142
152143 resource "scaleway_block_snapshot" "main" {
153144 volume_id = scaleway_block_volume.main.id
154145 }
155-
156146 resource "scaleway_block_snapshot" "additional1" {
157147 volume_id = scaleway_block_volume.additional1.id
158148 }
149+ resource "scaleway_block_snapshot" "additional2" {
150+ volume_id = scaleway_block_volume.additional2.id
151+ }
159152
160153 resource "scaleway_instance_image" "main" {
161154 name = "tf-test-image-external-block-volume"
162155 root_volume_id = scaleway_block_snapshot.main.id
163- additional_volume_ids = [scaleway_block_snapshot.additional1.id]
156+ additional_volume_ids = [
157+ scaleway_block_snapshot.additional1.id,
158+ scaleway_block_snapshot.additional2.id
159+ ]
164160 }
165161 ` ,
166162 Check : resource .ComposeTestCheckFunc (
167163 instancechecks .DoesImageExists (tt , "scaleway_instance_image.main" ),
168164 resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "root_volume_id" , "scaleway_block_snapshot.main" , "id" ),
169165 resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "architecture" , "x86_64" ),
170- resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volume_ids.#" , "1 " ),
166+ resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volume_ids.#" , "2 " ),
171167 resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volume_ids.0" , "scaleway_block_snapshot.additional1" , "id" ),
168+ resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volume_ids.1" , "scaleway_block_snapshot.additional2" , "id" ),
172169 ),
173170 },
174171 {
@@ -177,19 +174,24 @@ func TestAccImage_ExternalBlockVolume(t *testing.T) {
177174 size_in_gb = 50
178175 iops = 5000
179176 }
180-
181177 resource "scaleway_block_volume" "additional1" {
182178 size_in_gb = 50
183179 iops = 5000
184180 }
181+ resource "scaleway_block_volume" "additional2" {
182+ size_in_gb = 50
183+ iops = 5000
184+ }
185185
186186 resource "scaleway_block_snapshot" "main" {
187187 volume_id = scaleway_block_volume.main.id
188188 }
189-
190189 resource "scaleway_block_snapshot" "additional1" {
191190 volume_id = scaleway_block_volume.additional1.id
192191 }
192+ resource "scaleway_block_snapshot" "additional2" {
193+ volume_id = scaleway_block_volume.additional2.id
194+ }
193195
194196 resource "scaleway_instance_image" "main" {
195197 name = "tf-test-image-external-block-volume"
@@ -458,27 +460,15 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
458460 volume_type = "l_ssd"
459461 }
460462 }
461- resource "scaleway_instance_snapshot" "local01" {
462- volume_id = scaleway_instance_server.server01.root_volume.0.volume_id
463- depends_on = [ scaleway_instance_server.server01 ]
464- }
465- ` ,
466- Check : resource .ComposeTestCheckFunc (
467- isServerPresent (tt , "scaleway_instance_server.server01" ),
468- isSnapshotPresent (tt , "scaleway_instance_snapshot.local01" ),
469- ),
470- },
471- {
472- Config : `
473- resource "scaleway_instance_server" "server01" {
463+ resource "scaleway_instance_server" "server02" {
474464 image = "ubuntu_focal"
475465 type = "DEV1-S"
476466 root_volume {
477- size_in_gb = 15
467+ size_in_gb = 10
478468 volume_type = "l_ssd"
479469 }
480470 }
481- resource "scaleway_instance_server" "server02 " {
471+ resource "scaleway_instance_server" "server03 " {
482472 image = "ubuntu_focal"
483473 type = "DEV1-S"
484474 root_volume {
@@ -489,18 +479,21 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
489479
490480 resource "scaleway_instance_snapshot" "local01" {
491481 volume_id = scaleway_instance_server.server01.root_volume.0.volume_id
492- depends_on = [ scaleway_instance_server.server01 ]
493482 }
494483 resource "scaleway_instance_snapshot" "local02" {
495484 volume_id = scaleway_instance_server.server02.root_volume.0.volume_id
496- depends_on = [ scaleway_instance_server.server02 ]
485+ }
486+ resource "scaleway_instance_snapshot" "local03" {
487+ volume_id = scaleway_instance_server.server03.root_volume.0.volume_id
497488 }
498489 ` ,
499490 Check : resource .ComposeTestCheckFunc (
500491 isServerPresent (tt , "scaleway_instance_server.server01" ),
501492 isServerPresent (tt , "scaleway_instance_server.server02" ),
493+ isServerPresent (tt , "scaleway_instance_server.server03" ),
502494 isSnapshotPresent (tt , "scaleway_instance_snapshot.local01" ),
503495 isSnapshotPresent (tt , "scaleway_instance_snapshot.local02" ),
496+ isSnapshotPresent (tt , "scaleway_instance_snapshot.local03" ),
504497 ),
505498 },
506499 {
@@ -521,33 +514,43 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
521514 volume_type = "l_ssd"
522515 }
523516 }
517+ resource "scaleway_instance_server" "server03" {
518+ image = "ubuntu_focal"
519+ type = "DEV1-S"
520+ root_volume {
521+ size_in_gb = 10
522+ volume_type = "l_ssd"
523+ }
524+ }
524525
525526 resource "scaleway_instance_snapshot" "local01" {
526527 volume_id = scaleway_instance_server.server01.root_volume.0.volume_id
527- depends_on = [ scaleway_instance_server.server01 ]
528528 }
529529 resource "scaleway_instance_snapshot" "local02" {
530530 volume_id = scaleway_instance_server.server02.root_volume.0.volume_id
531- depends_on = [ scaleway_instance_server.server02 ]
531+ }
532+ resource "scaleway_instance_snapshot" "local03" {
533+ volume_id = scaleway_instance_server.server03.root_volume.0.volume_id
532534 }
533535
534536 resource "scaleway_instance_image" "main" {
535537 root_volume_id = scaleway_instance_snapshot.local01.id
536- additional_volume_ids = [ scaleway_instance_snapshot.local02.id ]
537- depends_on = [
538- scaleway_instance_snapshot.local01,
539- scaleway_instance_snapshot.local02,
538+ additional_volume_ids = [
539+ scaleway_instance_snapshot.local02.id,
540+ scaleway_instance_snapshot.local03.id
540541 ]
541542 }
542543 ` ,
543544 Check : resource .ComposeTestCheckFunc (
544- isServerPresent (tt , "scaleway_instance_server.server01" ),
545- isServerPresent (tt , "scaleway_instance_server.server02" ),
546545 isSnapshotPresent (tt , "scaleway_instance_snapshot.local01" ),
547546 isSnapshotPresent (tt , "scaleway_instance_snapshot.local02" ),
547+ isSnapshotPresent (tt , "scaleway_instance_snapshot.local03" ),
548548 instancechecks .DoesImageExists (tt , "scaleway_instance_image.main" ),
549549 resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "root_volume_id" , "scaleway_instance_snapshot.local01" , "id" ),
550- resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volumes.0.id" , "scaleway_instance_snapshot.local02" , "id" ),
550+ resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volumes.1.id" , "scaleway_instance_snapshot.local02" , "id" ),
551+ resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.1.volume_type" , "l_ssd" ),
552+ resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.1.size" , "10000000000" ),
553+ resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volumes.0.id" , "scaleway_instance_snapshot.local03" , "id" ),
551554 resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.0.volume_type" , "l_ssd" ),
552555 resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.0.size" , "10000000000" ),
553556 ),
0 commit comments