Skip to content

Commit

Permalink
remove storage transfer jobs from state if their status is DELETED (#…
Browse files Browse the repository at this point in the history
…5830) (#4138)

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Mar 18, 2022
1 parent fb1028d commit 31c8ab0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/5830.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
storage: fixed bug where `google_storage_transfer_job` that was deleted outside of Terraform would not be recreated on apply.
```
5 changes: 5 additions & 0 deletions google-beta/resource_storage_transfer_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ func resourceStorageTransferJobRead(d *schema.ResourceData, meta interface{}) er
return handleNotFoundError(err, d, fmt.Sprintf("Transfer Job %q", name))
}

if res.Status == "DELETED" {
d.SetId("")
return nil
}

if err := d.Set("project", res.ProjectId); err != nil {
return fmt.Errorf("Error setting project: %s", err)
}
Expand Down

0 comments on commit 31c8ab0

Please sign in to comment.