@@ -133,44 +133,41 @@ func TestAccImage_ExternalBlockVolume(t *testing.T) {
133133 size_in_gb = 50
134134 iops = 5000
135135 }
136-
137- resource "scaleway_block_snapshot" "main" {
138- volume_id = scaleway_block_volume.main.id
139- }
140- ` ,
141- },
142- {
143- Config : `
144- resource "scaleway_block_volume" "main" {
136+ resource "scaleway_block_volume" "additional1" {
145137 size_in_gb = 50
146138 iops = 5000
147139 }
148-
149- resource "scaleway_block_volume" "additional1" {
140+ resource "scaleway_block_volume" "additional2" {
150141 size_in_gb = 50
151142 iops = 5000
152143 }
153144
154145 resource "scaleway_block_snapshot" "main" {
155146 volume_id = scaleway_block_volume.main.id
156147 }
157-
158148 resource "scaleway_block_snapshot" "additional1" {
159149 volume_id = scaleway_block_volume.additional1.id
160150 }
151+ resource "scaleway_block_snapshot" "additional2" {
152+ volume_id = scaleway_block_volume.additional2.id
153+ }
161154
162155 resource "scaleway_instance_image" "main" {
163156 name = "tf-test-image-external-block-volume"
164157 root_volume_id = scaleway_block_snapshot.main.id
165- additional_volume_ids = [scaleway_block_snapshot.additional1.id]
158+ additional_volume_ids = [
159+ scaleway_block_snapshot.additional1.id,
160+ scaleway_block_snapshot.additional2.id
161+ ]
166162 }
167163 ` ,
168164 Check : resource .ComposeTestCheckFunc (
169165 instancechecks .DoesImageExists (tt , "scaleway_instance_image.main" ),
170166 resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "root_volume_id" , "scaleway_block_snapshot.main" , "id" ),
171167 resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "architecture" , "x86_64" ),
172- resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volume_ids.#" , "1 " ),
168+ resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volume_ids.#" , "2 " ),
173169 resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volume_ids.0" , "scaleway_block_snapshot.additional1" , "id" ),
170+ resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volume_ids.1" , "scaleway_block_snapshot.additional2" , "id" ),
174171 ),
175172 },
176173 {
@@ -179,19 +176,24 @@ func TestAccImage_ExternalBlockVolume(t *testing.T) {
179176 size_in_gb = 50
180177 iops = 5000
181178 }
182-
183179 resource "scaleway_block_volume" "additional1" {
184180 size_in_gb = 50
185181 iops = 5000
186182 }
183+ resource "scaleway_block_volume" "additional2" {
184+ size_in_gb = 50
185+ iops = 5000
186+ }
187187
188188 resource "scaleway_block_snapshot" "main" {
189189 volume_id = scaleway_block_volume.main.id
190190 }
191-
192191 resource "scaleway_block_snapshot" "additional1" {
193192 volume_id = scaleway_block_volume.additional1.id
194193 }
194+ resource "scaleway_block_snapshot" "additional2" {
195+ volume_id = scaleway_block_volume.additional2.id
196+ }
195197
196198 resource "scaleway_instance_image" "main" {
197199 name = "tf-test-image-external-block-volume"
@@ -463,27 +465,15 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
463465 volume_type = "l_ssd"
464466 }
465467 }
466- resource "scaleway_instance_snapshot" "local01" {
467- volume_id = scaleway_instance_server.server01.root_volume.0.volume_id
468- depends_on = [ scaleway_instance_server.server01 ]
469- }
470- ` ,
471- Check : resource .ComposeTestCheckFunc (
472- isServerPresent (tt , "scaleway_instance_server.server01" ),
473- isSnapshotPresent (tt , "scaleway_instance_snapshot.local01" ),
474- ),
475- },
476- {
477- Config : `
478- resource "scaleway_instance_server" "server01" {
468+ resource "scaleway_instance_server" "server02" {
479469 image = "ubuntu_focal"
480470 type = "DEV1-S"
481471 root_volume {
482- size_in_gb = 15
472+ size_in_gb = 10
483473 volume_type = "l_ssd"
484474 }
485475 }
486- resource "scaleway_instance_server" "server02 " {
476+ resource "scaleway_instance_server" "server03 " {
487477 image = "ubuntu_focal"
488478 type = "DEV1-S"
489479 root_volume {
@@ -494,18 +484,21 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
494484
495485 resource "scaleway_instance_snapshot" "local01" {
496486 volume_id = scaleway_instance_server.server01.root_volume.0.volume_id
497- depends_on = [ scaleway_instance_server.server01 ]
498487 }
499488 resource "scaleway_instance_snapshot" "local02" {
500489 volume_id = scaleway_instance_server.server02.root_volume.0.volume_id
501- depends_on = [ scaleway_instance_server.server02 ]
490+ }
491+ resource "scaleway_instance_snapshot" "local03" {
492+ volume_id = scaleway_instance_server.server03.root_volume.0.volume_id
502493 }
503494 ` ,
504495 Check : resource .ComposeTestCheckFunc (
505496 isServerPresent (tt , "scaleway_instance_server.server01" ),
506497 isServerPresent (tt , "scaleway_instance_server.server02" ),
498+ isServerPresent (tt , "scaleway_instance_server.server03" ),
507499 isSnapshotPresent (tt , "scaleway_instance_snapshot.local01" ),
508500 isSnapshotPresent (tt , "scaleway_instance_snapshot.local02" ),
501+ isSnapshotPresent (tt , "scaleway_instance_snapshot.local03" ),
509502 ),
510503 },
511504 {
@@ -526,33 +519,43 @@ func TestAccImage_ServerWithLocalVolume(t *testing.T) {
526519 volume_type = "l_ssd"
527520 }
528521 }
522+ resource "scaleway_instance_server" "server03" {
523+ image = "ubuntu_focal"
524+ type = "DEV1-S"
525+ root_volume {
526+ size_in_gb = 10
527+ volume_type = "l_ssd"
528+ }
529+ }
529530
530531 resource "scaleway_instance_snapshot" "local01" {
531532 volume_id = scaleway_instance_server.server01.root_volume.0.volume_id
532- depends_on = [ scaleway_instance_server.server01 ]
533533 }
534534 resource "scaleway_instance_snapshot" "local02" {
535535 volume_id = scaleway_instance_server.server02.root_volume.0.volume_id
536- depends_on = [ scaleway_instance_server.server02 ]
536+ }
537+ resource "scaleway_instance_snapshot" "local03" {
538+ volume_id = scaleway_instance_server.server03.root_volume.0.volume_id
537539 }
538540
539541 resource "scaleway_instance_image" "main" {
540542 root_volume_id = scaleway_instance_snapshot.local01.id
541- additional_volume_ids = [ scaleway_instance_snapshot.local02.id ]
542- depends_on = [
543- scaleway_instance_snapshot.local01,
544- scaleway_instance_snapshot.local02,
543+ additional_volume_ids = [
544+ scaleway_instance_snapshot.local02.id,
545+ scaleway_instance_snapshot.local03.id
545546 ]
546547 }
547548 ` ,
548549 Check : resource .ComposeTestCheckFunc (
549- isServerPresent (tt , "scaleway_instance_server.server01" ),
550- isServerPresent (tt , "scaleway_instance_server.server02" ),
551550 isSnapshotPresent (tt , "scaleway_instance_snapshot.local01" ),
552551 isSnapshotPresent (tt , "scaleway_instance_snapshot.local02" ),
552+ isSnapshotPresent (tt , "scaleway_instance_snapshot.local03" ),
553553 instancechecks .DoesImageExists (tt , "scaleway_instance_image.main" ),
554554 resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "root_volume_id" , "scaleway_instance_snapshot.local01" , "id" ),
555- resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volumes.0.id" , "scaleway_instance_snapshot.local02" , "id" ),
555+ resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volumes.1.id" , "scaleway_instance_snapshot.local02" , "id" ),
556+ resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.1.volume_type" , "l_ssd" ),
557+ resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.1.size" , "10000000000" ),
558+ resource .TestCheckResourceAttrPair ("scaleway_instance_image.main" , "additional_volumes.0.id" , "scaleway_instance_snapshot.local03" , "id" ),
556559 resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.0.volume_type" , "l_ssd" ),
557560 resource .TestCheckResourceAttr ("scaleway_instance_image.main" , "additional_volumes.0.size" , "10000000000" ),
558561 ),
0 commit comments