update openstack server metadata

This commit is contained in:
Jon Perritt 2015-01-02 12:40:42 -07:00
parent f9fa748024
commit cc9ee787ac
1 changed files with 15 additions and 1 deletions

View File

@ -221,7 +221,21 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
_, err := servers.Update(osClient, d.Id(), updateOpts).Extract() _, err := servers.Update(osClient, d.Id(), updateOpts).Extract()
if err != nil { if err != nil {
return fmt.Errorf("Error updating Openstack server: %s", err) return fmt.Errorf("Error updating OpenStack server: %s", err)
}
}
if d.HasChange("metadata") {
var metadataOpts servers.MetadataOpts
metadataOpts = make(servers.MetadataOpts)
newMetadata := d.Get("metadata").(map[string]interface{})
for k, v := range newMetadata {
metadataOpts[k] = v.(string)
}
_, err := servers.UpdateMetadata(osClient, d.Id(), metadataOpts).Extract()
if err != nil {
return fmt.Errorf("Error updating OpenStack server (%s) metadata: %s", d.Id(), err)
} }
} }