Skip to content
Draft
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/terraform-plugin-log v0.10.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.40.0
github.com/hashicorp/terraform-plugin-testing v1.15.0
github.com/oxidecomputer/oxide.go v0.9.0
github.com/oxidecomputer/oxide.go v0.9.1-0.20260415213236-1ba67f688351
github.com/stretchr/testify v1.11.1
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
github.com/oxidecomputer/oxide.go v0.9.0 h1:BwwRLsXomk43q+qQLWgksu8FhJJMftp85XQT5CDDCuw=
github.com/oxidecomputer/oxide.go v0.9.0/go.mod h1:I36KqKtLBuKdi9HeXRwP2FHc7s98+HvYgFozvfyKnpE=
github.com/oxidecomputer/oxide.go v0.9.1-0.20260415213236-1ba67f688351 h1:Re4zb/t96kOWnWohtE46tGkb4b7OuHnEKhy3H3FbOt0=
github.com/oxidecomputer/oxide.go v0.9.1-0.20260415213236-1ba67f688351/go.mod h1:I36KqKtLBuKdi9HeXRwP2FHc7s98+HvYgFozvfyKnpE=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4=
Expand Down
7 changes: 4 additions & 3 deletions internal/provider/resource_subnet_pool_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import (
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -360,11 +361,11 @@
}

if err := r.client.SystemSubnetPoolMemberRemove(ctx, params); err != nil {
// The API returns 400 with "does not exist" if the member is already gone,
// rather than 404. Handle both cases for idempotent deletes.
// The API returns 400 InvalidRequest with "does not exist" if the member
// is already gone, rather than 404. Handle both cases for idempotent deletes.
//
// TODO: Switch to a 404 in omicron.
if !is404(err) && !strings.Contains(err.Error(), "does not exist") {
if !is404(err) && !(errors.Is(err, oxide.ErrInvalidRequest) && strings.Contains(err.Error(), "does not exist")) {

Check failure on line 368 in internal/provider/resource_subnet_pool_member.go

View workflow job for this annotation

GitHub Actions / build-test

File is not properly formatted (golines)
resp.Diagnostics.AddError(
"Error deleting subnet pool member:",
"API error: "+err.Error(),
Expand Down
3 changes: 2 additions & 1 deletion internal/provider/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package provider

import (
"errors"
"net"
"strconv"
"strings"
Expand All @@ -24,7 +25,7 @@ func replaceBackticks(s string) string {
}

func is404(err error) bool {
return strings.Contains(err.Error(), "Status: 404")
return errors.Is(err, oxide.ErrObjectNotFound)
}

// Original function from https://pkg.go.dev/github.com/asaskevich/govalidator#IsIPv4
Expand Down
Loading