Return Read call result in Create & Update

This commit is contained in:
Guillaume Giamarchi 2015-02-19 23:44:49 +01:00 committed by Jon Perritt
parent bdeca31731
commit 83160acf69
3 changed files with 21 additions and 6 deletions

View File

@ -92,7 +92,7 @@ func resourceFWFirewallV1Create(d *schema.ResourceData, meta interface{}) error
d.SetId(firewall.ID)
return nil
return resourceFWFirewallV1Read(d, meta)
}
func resourceFWFirewallV1Read(d *schema.ResourceData, meta interface{}) error {
@ -183,7 +183,12 @@ func resourceFWFirewallV1Update(d *schema.ResourceData, meta interface{}) error
_, err = stateConf.WaitForState()
return firewalls.Update(networkingClient, d.Id(), opts).Err
err = firewalls.Update(networkingClient, d.Id(), opts).Err
if err != nil {
return err
}
return resourceFWFirewallV1Read(d, meta)
}
func resourceFWFirewallV1Delete(d *schema.ResourceData, meta interface{}) error {

View File

@ -104,7 +104,7 @@ func resourceFWPolicyV1Create(d *schema.ResourceData, meta interface{}) error {
d.SetId(policy.ID)
return nil
return resourceFWPolicyV1Read(d, meta)
}
func resourceFWPolicyV1Read(d *schema.ResourceData, meta interface{}) error {
@ -188,7 +188,12 @@ func resourceFWPolicyV1Update(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] Updating firewall policy with id %s: %#v", d.Id(), opts)
return policies.Update(networkingClient, d.Id(), opts).Err
err = policies.Update(networkingClient, d.Id(), opts).Err
if err != nil {
return err
}
return resourceFWPolicyV1Read(d, meta)
}
func resourceFWPolicyV1Delete(d *schema.ResourceData, meta interface{}) error {

View File

@ -110,7 +110,7 @@ func resourceFWRuleV1Create(d *schema.ResourceData, meta interface{}) error {
d.SetId(rule.ID)
return nil
return resourceFWRuleV1Read(d, meta)
}
func resourceFWRuleV1Read(d *schema.ResourceData, meta interface{}) error {
@ -229,7 +229,12 @@ func resourceFWRuleV1Update(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] Updating firewall rules: %#v", opts)
return rules.Update(networkingClient, d.Id(), opts).Err
err = rules.Update(networkingClient, d.Id(), opts).Err
if err != nil {
return err
}
return resourceFWRuleV1Read(d, meta)
}
func resourceFWRuleV1Delete(d *schema.ResourceData, meta interface{}) error {