Add SelfLink field to GCE firewall resource.

This commit is contained in:
David Watson 2015-02-10 11:14:15 +00:00
parent 2b26177903
commit 4e1a421652
1 changed files with 8 additions and 1 deletions

View File

@ -86,6 +86,11 @@ func resourceComputeFirewall() *schema.Resource {
return hashcode.String(v.(string))
},
},
"self_link": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
}
}
@ -159,7 +164,7 @@ func resourceComputeFirewallCreate(d *schema.ResourceData, meta interface{}) err
func resourceComputeFirewallRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
_, err := config.clientCompute.Firewalls.Get(
firewall, err := config.clientCompute.Firewalls.Get(
config.Project, d.Id()).Do()
if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 {
@ -172,6 +177,8 @@ func resourceComputeFirewallRead(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("Error reading firewall: %s", err)
}
d.Set("self_link", firewall.SelfLink)
return nil
}