provider/google: Improve backend service error handling
Unset id in case the backend service cannot be created. This basically updates these lines of code to match the more modern style which is being used e.g. for the google_compute_instance resource.
This commit is contained in:
parent
7ecc515704
commit
08b9a11b42
|
@ -200,11 +200,15 @@ func resourceComputeBackendServiceCreate(d *schema.ResourceData, meta interface{
|
|||
|
||||
log.Printf("[DEBUG] Waiting for new backend service, operation: %#v", op)
|
||||
|
||||
// Store the ID now
|
||||
d.SetId(service.Name)
|
||||
|
||||
err = computeOperationWaitGlobal(config, op, project, "Creating Backend Service")
|
||||
if err != nil {
|
||||
return err
|
||||
// Wait for the operation to complete
|
||||
waitErr := computeOperationWaitGlobal(config, op, project, "Creating Backend Service")
|
||||
if waitErr != nil {
|
||||
// The resource didn't actually create
|
||||
d.SetId("")
|
||||
return waitErr
|
||||
}
|
||||
|
||||
return resourceComputeBackendServiceRead(d, meta)
|
||||
|
|
Loading…
Reference in New Issue