Added a new attribute : source_disk_link

This commit is contained in:
Thomas Poindessous 2017-04-20 12:12:43 +02:00
parent 5fcc6593cd
commit 573da4d729
2 changed files with 10 additions and 3 deletions

View File

@ -59,6 +59,11 @@ func resourceComputeSnapshot() *schema.Resource {
ForceNew: true,
},
"source_disk_link": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -137,6 +142,8 @@ func resourceComputeSnapshotRead(d *schema.ResourceData, meta interface{}) error
}
d.Set("self_link", snapshot.SelfLink)
d.Set("source_disk_link", snapshot.SourceDisk)
d.Set("name", snapshot.Name)
if snapshot.SnapshotEncryptionKey != nil && snapshot.SnapshotEncryptionKey.Sha256 != "" {
d.Set("snapshot_encryption_key_sha256", snapshot.SnapshotEncryptionKey.Sha256)
@ -146,8 +153,6 @@ func resourceComputeSnapshotRead(d *schema.ResourceData, meta interface{}) error
d.Set("source_disk_encryption_key_sha256", snapshot.SourceDiskEncryptionKey.Sha256)
}
d.Set("source_disk", snapshot.SourceDisk)
return nil
}

View File

@ -29,7 +29,7 @@ The following arguments are supported:
* `zone` - (Required) The zone where the source disk is located.
* `source_disk` - (Required) The disk which will be used as the source of the snapshot
* `source_disk` - (Required) The disk which will be used as the source of the snapshot.
- - -
@ -61,4 +61,6 @@ exported:
[customer-supplied encryption key](https://cloud.google.com/compute/docs/disks/customer-supplied-encryption)
that protects the source disk.
* `source_disk_link` - The URI of the source disk.
* `self_link` - The URI of the created resource.