The post Error: Error decoding “admin_ssh_key.0.public_key” for public key data appeared first on For all your terraform needs.
]]>resource "azurerm_linux_virtual_machine" "myvm" { name = local.vm_name resource_group_name = azurerm_resource_group.rg_des.name location = azurerm_resource_group.rg_des.location size = var.vm_size admin_username = "adminuser" network_interface_ids = [ azurerm_network_interface.myvm.id, ] admin_ssh_key { username = "adminuser" #public_key = file("~/.ssh/id_rsa.pub") public_key = tls_private_key.linux_test_ssh.public_key_openssh }
Instead of doing it through an existing key pair, I used terraform to create the ssh key pair. This worked – no error
# Create (and display) an SSH key resource "tls_private_key" "linux_test_ssh" { algorithm = "RSA" rsa_bits = 4096 }
The post Error: Error decoding “admin_ssh_key.0.public_key” for public key data appeared first on For all your terraform needs.
]]>