Skip to content

Commit

Permalink
if resource is not found we should be fine
Browse files Browse the repository at this point in the history
  • Loading branch information
juandspy committed Oct 28, 2022
1 parent 1f477b4 commit 3c32d68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rhoas/kafka/resource_kafka.go
Expand Up @@ -184,6 +184,9 @@ func kafkaDelete(ctx context.Context, d *schema.ResourceData, m interface{}) dia
},
Refresh: func() (interface{}, string, error) {
data, resp, err1 := factory.KafkaMgmt().GetKafkaById(ctx, d.Id()).Execute()
if resp.StatusCode == http.StatusNotFound {
return data, "deleted", nil
}
if apiErr := utils.GetAPIError(factory, resp, err1); apiErr != nil {
return nil, "", apiErr
}
Expand Down
3 changes: 3 additions & 0 deletions rhoas/tests/serviceaccount_test.go
Expand Up @@ -188,6 +188,9 @@ func testAccCheckServiceAccountDestroy(s *terraform.State) error {

// Retrieve the service account struct by referencing it's state ID for API lookup
serviceAccount, resp, err := factory.ServiceAccountMgmt().GetServiceAccount(context.Background(), rs.Primary.ID).Execute()
if resp.StatusCode == http.StatusNotFound {
return nil
}
if apiErr := utils.GetAPIError(factory, resp, err); apiErr != nil {
return apiErr
}
Expand Down

0 comments on commit 3c32d68

Please sign in to comment.