diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f7de188..5e1b43ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +BUG FIXES: + +- Ignore block storage detach error when already detached #393 + ## 0.62.3 BUG FIXES: diff --git a/pkg/resources/instance/resource.go b/pkg/resources/instance/resource.go index 3b4035a9..78dacda8 100644 --- a/pkg/resources/instance/resource.go +++ b/pkg/resources/instance/resource.go @@ -617,11 +617,14 @@ func rUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag bid, ) if err != nil { - if !errors.Is(err, v3.ErrNotFound) { - return diag.Errorf("failed to detach block storage: %s", err) + // Ideally we would have a custom error defined in OpenAPI spec & egoscale. + // For now we just check the error text. + if strings.HasSuffix(err.Error(), "Volume not attached") { + tflog.Info(ctx, "volume not attached") + continue } - continue + return diag.Errorf("failed to detach block storage: %s", err) } _, err = clientV3.Wait(ctx, op, v3.OperationStateSuccess)