From 7cd15138401acda840534b6b3cac49d5a5f5eea8 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 13 Nov 2017 11:29:11 +0000 Subject: [PATCH] Handling a crash when the storage_account block is nil. Fixes #491 --- azurerm/resource_arm_container_registry_migrate.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/azurerm/resource_arm_container_registry_migrate.go b/azurerm/resource_arm_container_registry_migrate.go index 729a21ec255d..edf8fdabf385 100644 --- a/azurerm/resource_arm_container_registry_migrate.go +++ b/azurerm/resource_arm_container_registry_migrate.go @@ -75,8 +75,13 @@ func updateV1ToV2StorageAccountName(is *terraform.InstanceState, meta interface{ } inputAccounts := result.Value.([]interface{}) - inputAccount := inputAccounts[0].(map[string]interface{}) - name := inputAccount["name"].(string) + inputAccount := inputAccounts[0] + if inputAccount == nil { + return nil + } + + account := inputAccount.(map[string]interface{}) + name := account["name"].(string) storageAccountId, err := findAzureStorageAccountIdFromName(name, meta) if err != nil { return err