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)
|
log.Printf("[DEBUG] Waiting for new backend service, operation: %#v", op)
|
||||||
|
|
||||||
|
// Store the ID now
|
||||||
d.SetId(service.Name)
|
d.SetId(service.Name)
|
||||||
|
|
||||||
err = computeOperationWaitGlobal(config, op, project, "Creating Backend Service")
|
// Wait for the operation to complete
|
||||||
if err != nil {
|
waitErr := computeOperationWaitGlobal(config, op, project, "Creating Backend Service")
|
||||||
return err
|
if waitErr != nil {
|
||||||
|
// The resource didn't actually create
|
||||||
|
d.SetId("")
|
||||||
|
return waitErr
|
||||||
}
|
}
|
||||||
|
|
||||||
return resourceComputeBackendServiceRead(d, meta)
|
return resourceComputeBackendServiceRead(d, meta)
|
||||||
|
|
Loading…
Reference in New Issue