Skip to content

Commit

Permalink
Merged in TER-258_remove-ghost-app-from-state (pull request #9)
Browse files Browse the repository at this point in the history
TER-258: Remove app from state if not found

Approved-by: Jordan Caussat <[email protected]>
Approved-by: Jérôme Respaut <[email protected]>
Approved-by: Patrick Decat <[email protected]>
Approved-by: PERRIER Aurélien <[email protected]>
Approved-by: Burak Karamahmut <[email protected]>
  • Loading branch information
Jordan Caussat authored and Shr3ps committed Apr 10, 2018
2 parents 8b1549b + abea547 commit 998fcb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ghost/resource_ghost_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,12 @@ func resourceGhostAppRead(d *schema.ResourceData, meta interface{}) error {

app, err := client.GetApp(d.Id())
if err != nil {
d.SetId("")
// If app was not found, return nil to show that app is gone
if err.Error()[len(err.Error())-3:] == "404" {
d.SetId("")
log.Printf("[WARN] Ghost app (%s) not found, removing from state", d.Id())
return nil
}
return fmt.Errorf("[ERROR] error reading Ghost app: %v", err)
}

Expand Down

0 comments on commit 998fcb5

Please sign in to comment.