From d46a13469ac522b8d130d83ab673b13c8e3afdd6 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 24 Jan 2018 13:19:50 +0100 Subject: [PATCH] Making the Source Resource ID computed --- azurerm/resource_arm_snapshot.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/azurerm/resource_arm_snapshot.go b/azurerm/resource_arm_snapshot.go index 0bcca2c96837..423dd4365a59 100644 --- a/azurerm/resource_arm_snapshot.go +++ b/azurerm/resource_arm_snapshot.go @@ -52,6 +52,7 @@ func resourceArmSnapshot() *schema.Resource { "source_resource_id": { Type: schema.TypeString, Optional: true, + Computed: true, ForceNew: true, }, @@ -172,16 +173,16 @@ func resourceArmSnapshotRead(d *schema.ResourceData, meta interface{}) error { if data := props.CreationData; data != nil { d.Set("create_option", string(data.CreateOption)) - if data.SourceURI != nil { - d.Set("source_uri", data.SourceURI) + if uri := data.SourceURI; uri != nil { + d.Set("source_uri", uri) } - if data.SourceResourceID != nil { - d.Set("source_resource_id", data.SourceResourceID) + if resourceId := data.SourceResourceID; resourceId != nil { + d.Set("source_resource_id", resourceId) } - if data.StorageAccountID != nil { - d.Set("storage_account_id", *data.StorageAccountID) + if accountId := data.StorageAccountID; accountId != nil { + d.Set("storage_account_id", accountId) } }