providers/google: partial updates with compute_instance

This commit is contained in:
Mitchell Hashimoto 2014-08-26 20:31:35 -07:00
parent 9b430b911e
commit 5049f0b111

View File

@ -321,6 +321,9 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
// Enable partial mode for the resource since it is possible
d.Partial(true)
// If the Metadata has changed, then update that.
if d.HasChange("metadata") {
metadata := resourceInstanceMetadata(d)
@ -350,6 +353,8 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
// Return the error
return OperationError(*op.Error)
}
d.SetPartial("metadata")
}
if d.HasChange("tags") {
@ -380,8 +385,13 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
// Return the error
return OperationError(*op.Error)
}
d.SetPartial("tags")
}
// We made it, disable partial mode
d.Partial(false)
return resourceComputeInstanceRead(d, meta)
}