Skip to content

Commit

Permalink
treat project 404s correctly in project service read (#3354) (#1941)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Apr 7, 2020
1 parent 99beb07 commit 01943b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .changelog/3354.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
10 changes: 5 additions & 5 deletions google-beta/resource_google_project_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ func resourceGoogleProjectServiceRead(d *schema.ResourceData, meta interface{})

// Verify project for services still exists
p, err := config.clientResourceManager.Projects.Get(project).Do()
if err != nil {
return err
}
if p.LifecycleState == "DELETE_REQUESTED" {
if err == nil && p.LifecycleState == "DELETE_REQUESTED" {
// Construct a 404 error for handleNotFoundError
return &googleapi.Error{
err = &googleapi.Error{
Code: 404,
Message: "Project deletion was requested",
}
}
if err != nil {
return handleNotFoundError(err, d, fmt.Sprintf("Project Service %s", d.Id()))
}

servicesRaw, err := BatchRequestReadServices(project, d, config)
if err != nil {
Expand Down

0 comments on commit 01943b2

Please sign in to comment.