Fix Google Cloud Service Account provider .Read (#14282)

The implementation would return an error if the resource was detected as
removed - this would break Terraform instead of making it re-create the
missing service account.
This commit is contained in:
Sergiusz Bazański 2017-05-08 16:02:54 +02:00 committed by Clint
parent dd5577ee44
commit 0175129d9e
1 changed files with 1 additions and 2 deletions

View File

@ -118,11 +118,10 @@ func resourceGoogleServiceAccountRead(d *schema.ResourceData, meta interface{})
if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 {
log.Printf("[WARN] Removing reference to service account %q because it no longer exists", d.Id())
saName := d.Id()
// The resource doesn't exist anymore
d.SetId("")
return fmt.Errorf("Error getting service account with name %q: %s", saName, err)
return nil
}
return fmt.Errorf("Error reading service account %q: %q", d.Id(), err)
}