From eb35b4ccbf43dea74082eec3a27b114005fa9b43 Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Wed, 11 Jan 2023 10:37:20 +0100 Subject: [PATCH] fix: delete forced volume removal (#71) --- builder/scaleway/builder_acc_test.go | 1 + builder/scaleway/step_create_server.go | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/builder/scaleway/builder_acc_test.go b/builder/scaleway/builder_acc_test.go index dcb6bbb..94bf80a 100644 --- a/builder/scaleway/builder_acc_test.go +++ b/builder/scaleway/builder_acc_test.go @@ -44,6 +44,7 @@ source "scaleway" "basic" { image_name = "Acceptance test" ssh_username = "root" zone = "fr-par-1" + remove_volume = true } build { diff --git a/builder/scaleway/step_create_server.go b/builder/scaleway/step_create_server.go index d21221b..dea2baa 100644 --- a/builder/scaleway/step_create_server.go +++ b/builder/scaleway/step_create_server.go @@ -126,8 +126,6 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu } func (s *stepCreateServer) Cleanup(state multistep.StateBag) { - volumeID := state.Get("root_volume_id").(string) - if s.serverID == "" { return } @@ -150,15 +148,4 @@ func (s *stepCreateServer) Cleanup(state multistep.StateBag) { "Error destroying server. Please destroy it manually: %s", err)) } } - - ui.Say("Removing volume ...") - - err = instanceAPI.DeleteVolume(&instance.DeleteVolumeRequest{ - VolumeID: volumeID, - }) - if err != nil { - err := fmt.Errorf("error removing volume: %s", err) - state.Put("error", err) - ui.Error(fmt.Sprintf("Error removing volume: %s. Please destroy it manually", err)) - } }