diff --git a/rhoas/kafka/resource_kafka.go b/rhoas/kafka/resource_kafka.go index 514416c..a0fc8e6 100644 --- a/rhoas/kafka/resource_kafka.go +++ b/rhoas/kafka/resource_kafka.go @@ -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 } diff --git a/rhoas/tests/serviceaccount_test.go b/rhoas/tests/serviceaccount_test.go index 965702b..a62c95d 100644 --- a/rhoas/tests/serviceaccount_test.go +++ b/rhoas/tests/serviceaccount_test.go @@ -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 }