Add SelfLink field to GCE route resource.

This commit is contained in:
David Watson 2015-02-10 11:15:07 +00:00
parent 91b000fd31
commit a3ca34ac88
1 changed files with 8 additions and 1 deletions

View File

@ -80,6 +80,11 @@ func resourceComputeRoute() *schema.Resource {
return hashcode.String(v.(string)) return hashcode.String(v.(string))
}, },
}, },
"self_link": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
}, },
} }
} }
@ -183,7 +188,7 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error
func resourceComputeRouteRead(d *schema.ResourceData, meta interface{}) error { func resourceComputeRouteRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config) config := meta.(*Config)
_, err := config.clientCompute.Routes.Get( route, err := config.clientCompute.Routes.Get(
config.Project, d.Id()).Do() config.Project, d.Id()).Do()
if err != nil { if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 { if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 {
@ -196,6 +201,8 @@ func resourceComputeRouteRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error reading route: %#v", err) return fmt.Errorf("Error reading route: %#v", err)
} }
d.Set("self_link", route.SelfLink)
return nil return nil
} }