Add SelfLink field to GCE disk resource.

This commit is contained in:
David Watson 2015-02-10 11:13:55 +00:00
parent e81c995301
commit 2b26177903
1 changed files with 8 additions and 1 deletions

View File

@ -46,6 +46,11 @@ func resourceComputeDisk() *schema.Resource {
Optional: true,
ForceNew: true,
},
"self_link": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
}
}
@ -132,7 +137,7 @@ func resourceComputeDiskCreate(d *schema.ResourceData, meta interface{}) error {
func resourceComputeDiskRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
_, err := config.clientCompute.Disks.Get(
disk, err := config.clientCompute.Disks.Get(
config.Project, d.Get("zone").(string), d.Id()).Do()
if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 {
@ -145,6 +150,8 @@ func resourceComputeDiskRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error reading disk: %s", err)
}
d.Set("self_link", disk.SelfLink)
return nil
}