@@ -13,76 +13,6 @@ import (
1313 instancechecks "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/instance/testfuncs"
1414)
1515
16- func TestAccSnapshot_BlockVolume (t * testing.T ) {
17- t .Skip ("Resource \" scaleway_instance_snapshot\" is depracated for block volumes" )
18-
19- tt := acctest .NewTestTools (t )
20- defer tt .Cleanup ()
21- resource .ParallelTest (t , resource.TestCase {
22- PreCheck : func () { acctest .PreCheck (t ) },
23- ProviderFactories : tt .ProviderFactories ,
24- CheckDestroy : instancechecks .IsVolumeDestroyed (tt ),
25- Steps : []resource.TestStep {
26- {
27- Config : `
28- resource "scaleway_instance_volume" "main" {
29- type = "b_ssd"
30- size_in_gb = 20
31- }
32-
33- resource "scaleway_instance_snapshot" "main" {
34- volume_id = scaleway_instance_volume.main.id
35- }` ,
36- Check : resource .ComposeTestCheckFunc (
37- isSnapshotPresent (tt , "scaleway_instance_snapshot.main" ),
38- ),
39- },
40- },
41- })
42- }
43-
44- func TestAccSnapshot_Unified (t * testing.T ) {
45- tt := acctest .NewTestTools (t )
46- defer tt .Cleanup ()
47- resource .Test (t , resource.TestCase {
48- PreCheck : func () { acctest .PreCheck (t ) },
49- ProviderFactories : tt .ProviderFactories ,
50- CheckDestroy : instancechecks .IsVolumeDestroyed (tt ),
51- Steps : []resource.TestStep {
52- {
53- Config : `
54- resource "scaleway_instance_volume" "main" {
55- type = "l_ssd"
56- size_in_gb = 10
57- }
58-
59- resource "scaleway_instance_server" "main" {
60- image = "ubuntu_jammy"
61- type = "DEV1-S"
62- root_volume {
63- size_in_gb = 10
64- volume_type = "l_ssd"
65- }
66- additional_volume_ids = [
67- scaleway_instance_volume.main.id
68- ]
69- }
70-
71- resource "scaleway_instance_snapshot" "main" {
72- volume_id = scaleway_instance_volume.main.id
73- type = "unified"
74- depends_on = [scaleway_instance_server.main]
75- }
76- ` ,
77- Check : resource .ComposeTestCheckFunc (
78- isSnapshotPresent (tt , "scaleway_instance_snapshot.main" ),
79- resource .TestCheckResourceAttr ("scaleway_instance_snapshot.main" , "type" , "unified" ),
80- ),
81- },
82- },
83- })
84- }
85-
8616func TestAccSnapshot_Server (t * testing.T ) {
8717 tt := acctest .NewTestTools (t )
8818 defer tt .Cleanup ()
@@ -112,136 +42,6 @@ func TestAccSnapshot_Server(t *testing.T) {
11242 })
11343}
11444
115- func TestAccSnapshot_ServerWithBlockVolume (t * testing.T ) {
116- t .Skip ("Resource \" scaleway_instance_snapshot\" is depracated for block volumes" )
117-
118- tt := acctest .NewTestTools (t )
119- defer tt .Cleanup ()
120- resource .ParallelTest (t , resource.TestCase {
121- PreCheck : func () { acctest .PreCheck (t ) },
122- ProviderFactories : tt .ProviderFactories ,
123- CheckDestroy : resource .ComposeTestCheckFunc (
124- instancechecks .IsVolumeDestroyed (tt ),
125- instancechecks .IsServerDestroyed (tt ),
126- isSnapshotDestroyed (tt ),
127- ),
128- Steps : []resource.TestStep {
129- {
130- Config : `
131- resource "scaleway_instance_volume" main {
132- type = "b_ssd"
133- size_in_gb = 10
134- }
135-
136- resource "scaleway_instance_server" main {
137- image = "ubuntu_focal"
138- type = "DEV1-S"
139- root_volume {
140- size_in_gb = 10
141- volume_type = "l_ssd"
142- }
143- additional_volume_ids = [
144- scaleway_instance_volume.main.id
145- ]
146- }
147-
148- resource "scaleway_instance_snapshot" main {
149- volume_id = scaleway_instance_volume.main.id
150- }` ,
151- Check : resource .ComposeTestCheckFunc (
152- isSnapshotPresent (tt , "scaleway_instance_snapshot.main" ),
153- ),
154- },
155- },
156- })
157- }
158-
159- func TestAccSnapshot_RenameSnapshot (t * testing.T ) {
160- t .Skip ("Resource \" scaleway_instance_snapshot\" is depracated for block volumes" )
161-
162- tt := acctest .NewTestTools (t )
163- defer tt .Cleanup ()
164- resource .ParallelTest (t , resource.TestCase {
165- PreCheck : func () { acctest .PreCheck (t ) },
166- ProviderFactories : tt .ProviderFactories ,
167- CheckDestroy : instancechecks .IsVolumeDestroyed (tt ),
168- Steps : []resource.TestStep {
169- {
170- Config : `
171- resource "scaleway_instance_volume" "main" {
172- type = "b_ssd"
173- size_in_gb = 20
174- }
175-
176- resource "scaleway_instance_snapshot" "main" {
177- volume_id = scaleway_instance_volume.main.id
178- name = "first_name"
179- tags = ["test-terraform"]
180- }` ,
181- Check : resource .ComposeTestCheckFunc (
182- isSnapshotPresent (tt , "scaleway_instance_snapshot.main" ),
183- resource .TestCheckResourceAttr ("scaleway_instance_snapshot.main" , "tags.0" , "test-terraform" ),
184- ),
185- },
186- {
187- Config : `
188- resource "scaleway_instance_volume" "main" {
189- type = "b_ssd"
190- size_in_gb = 20
191- }
192-
193- resource "scaleway_instance_snapshot" "main" {
194- volume_id = scaleway_instance_volume.main.id
195- name = "second_name"
196- }` ,
197- Check : resource .ComposeTestCheckFunc (
198- isSnapshotPresent (tt , "scaleway_instance_snapshot.main" ),
199- resource .TestCheckResourceAttr ("scaleway_instance_snapshot.main" , "tags.#" , "0" ),
200- ),
201- },
202- },
203- })
204- }
205-
206- func TestAccSnapshot_FromObject (t * testing.T ) {
207- t .Skip ("Resource \" scaleway_instance_snapshot\" is depracated" )
208- // TestAccSnapshot_FromS3 tests the same logic on the scaleway_block_snapshot resource
209-
210- tt := acctest .NewTestTools (t )
211- defer tt .Cleanup ()
212- resource .ParallelTest (t , resource.TestCase {
213- PreCheck : func () { acctest .PreCheck (t ) },
214- ProviderFactories : tt .ProviderFactories ,
215- CheckDestroy : instancechecks .IsVolumeDestroyed (tt ),
216- Steps : []resource.TestStep {
217- {
218- Config : `
219- resource "scaleway_object_bucket" "bucket" {
220- name = "test-instance-snapshot-import-from-object"
221- }
222-
223- resource "scaleway_object" "image" {
224- bucket = scaleway_object_bucket.bucket.name
225- key = "image.qcow"
226- file = "testfixture/empty.qcow2"
227- }
228-
229- resource "scaleway_block_snapshot" "snapshot" {
230- name = "test-instance-snapshot-import-from-object"
231- type = "b_ssd"
232- import {
233- bucket = scaleway_object.image.bucket
234- key = scaleway_object.image.key
235- }
236- }` ,
237- Check : resource .ComposeTestCheckFunc (
238- isSnapshotPresent (tt , "scaleway_instance_snapshot.snapshot" ),
239- ),
240- },
241- },
242- })
243- }
244-
24545func isSnapshotPresent (tt * acctest.TestTools , n string ) resource.TestCheckFunc {
24646 return func (s * terraform.State ) error {
24747 rs , ok := s .RootModule ().Resources [n ]
0 commit comments