providers/google: partial updates with compute_instance

This commit is contained in:
Mitchell Hashimoto 2014-08-26 20:31:35 -07:00
parent 87a488092c
commit bfbb9201c4
1 changed files with 10 additions and 0 deletions

View File

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