fix: remove stale resources from state#91
Conversation
|
Is this testable? |
Should be no problem. I will add a test. |
|
@jkroepke The |
|
Leider unsauber geschrieben. terraform-provider-hetznerdns/internal/api/primary_server.go Lines 36 to 38 in 71801ea gibt auch nil bei not found zurück, aber auch keinen Fehler. Daher Nil Pointer panic |
|
Should be fixed now. |
| return nil | ||
| }) | ||
| if err != nil { | ||
| if err != nil && fmt.Sprint(err) != fmt.Sprintf("primary server %s not found", state.ID.ValueString()) { |
There was a problem hiding this comment.
@kimdre das ist echt schlechtes go :D
besser wäre es, im api packages
var ErrNotFound = errors.New("not found")
dann beim error
return nil, fmt.Errorf("primary server %s: %w", id, ErrNotFound)
und hier in der condition:
if err != nil && !errors.Is(err, api.ErrNotFound))
There was a problem hiding this comment.
undd as ganze auch für zones und records :D
There was a problem hiding this comment.
Jaja hatte da keine Zeit mehr für ne schöne Lösung 😂
#92
Stale resources will now get deleted from the state on
Readexecution instead of showing aWarning: Resource Not Found