Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore block storage detach error when already detached #393

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

BUG FIXES:

- Ignore block storage detach error when already detached #393

## 0.62.3

BUG FIXES:
Expand Down
9 changes: 6 additions & 3 deletions pkg/resources/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading