From e49b23a6ee9adae6650bc72c638cf1153336857e Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 7 Dec 2018 14:37:40 -0800 Subject: [PATCH] Fix nested read in Snapshot. (#2593) /cc @rileykarson --- google/resource_compute_snapshot.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/google/resource_compute_snapshot.go b/google/resource_compute_snapshot.go index c4bfdfdc..1e416748 100644 --- a/google/resource_compute_snapshot.go +++ b/google/resource_compute_snapshot.go @@ -749,7 +749,10 @@ func expandComputeSnapshotSourceDiskEncryptionKey(v interface{}, d *schema.Resou } func resourceComputeSnapshotDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) { - d.Set("source_disk_link", res["sourceDisk"]) - d.Set("snapshot_encryption_key_sha256", res["snapshotEncryptionKey"].((map[string]interface{}))["sha256"]) + d.Set("source_disk_link", ConvertSelfLinkToV1(res["sourceDisk"].(string))) + if snapshotEncryptionKey := res["snapshotEncryptionKey"]; snapshotEncryptionKey != nil { + d.Set("snapshot_encryption_key_sha256", snapshotEncryptionKey.((map[string]interface{}))["sha256"]) + } + return res, nil }