Skip to content

Commit

Permalink
Remove google_project_service from state if not found (GoogleCloudP…
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn authored and khajduczenia committed Oct 12, 2021
1 parent feb085a commit fc178a4
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,8 @@ func resourceGoogleProjectServiceRead(d *schema.ResourceData, meta interface{})
return nil
}

// If we get here due to eventual consistency, the next apply will fix things
// instead of re-creating the resource and if we didn't get here by error,
// the next apply will (correctly) remove it from state, anyways. Seeing as
// no downstreams can possibly get the result, as we're halting execution,
// it's safe to rely on refresh for putting the state back in order.
if !d.IsNewResource() {
// The service is was not found in enabled services - return an error
return fmt.Errorf("service %s not in enabled services for project %s", srv, project)
}
log.Printf("[DEBUG] service %s not in enabled services for project %s, removing from state", srv, project)
d.SetId("")
return nil
}

Expand Down

0 comments on commit fc178a4

Please sign in to comment.