From bd073c539ea91a72f9d0e91f5037ecf9d9425817 Mon Sep 17 00:00:00 2001 From: Maxime Bury Date: Thu, 19 May 2016 16:45:58 +0100 Subject: [PATCH] Fixes terraform crash when using SSH keys with Azure VMs (#6766) --- builtin/providers/azurerm/resource_arm_virtual_machine.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builtin/providers/azurerm/resource_arm_virtual_machine.go b/builtin/providers/azurerm/resource_arm_virtual_machine.go index 080f423d0..5868d11ac 100644 --- a/builtin/providers/azurerm/resource_arm_virtual_machine.go +++ b/builtin/providers/azurerm/resource_arm_virtual_machine.go @@ -927,9 +927,13 @@ func expandAzureRmVirtualMachineOsProfileLinuxConfig(d *schema.ResourceData) (*c } linuxKeys := linuxConfig["ssh_keys"].([]interface{}) - sshPublicKeys := make([]compute.SSHPublicKey, 0, len(linuxKeys)) + sshPublicKeys := []compute.SSHPublicKey{} for _, key := range linuxKeys { - sshKey := key.(map[string]interface{}) + + sshKey, ok := key.(map[string]interface{}) + if !ok { + continue + } path := sshKey["path"].(string) keyData := sshKey["key_data"].(string)