phydeauxman
phydeauxman

Reputation: 1712

What goes in the ssh_keys > key_data argument in a Terraform template

I have a template to deploy a Linux VM in Azure and am trying to use SSH keys for authentication. When using the "ssh_keys" argument, what goes in the "key_data" sub argument? I am sure it is something to do with my public key, I am just not sure what exactly.

Upvotes: 1

Views: 4079

Answers (1)

Shui shengbao
Shui shengbao

Reputation: 19225

The key_data is your public key. Your understanding is right.

See this example.

os_profile_linux_config {
    disable_password_authentication = true
    ssh_keys {
        path     = "/home/<user>/.ssh/authorized_keys"
        key_data = "ssh-rsa AAAAB3Nz{snip}hwhqT9h"
    }
}

key_data value is like ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVVucKplaLrdLQZZuESOL8/C07QMheKksR99jBJRyHFqjourKbn6LFvVqwr3ZwxTiCKGarDKzGU3rMwR3itzS3SpJ5pgskbYS+yQsjy//YMVgNNUIvAroQdA9XCYEBBHm/9zGJAWakclGScFW2QaNnJIZlTmaXKyWxAOymIYzS2KsLhqiJDaP5j0j73IARNVgd2gFrxq3U7pnaYKYbPkhEQtPz6V2tXrYgu/M/rEW/Ibit94Z/w/+GHe44IviuXwjLez7Hu24jVx95hsza0AMfnWoPfsk76IEOABvTkJ6sXKfF1DkvPNw/5od/97Mk8eQHmWQLt9rFqiF/r1YrecZN root@shui

Upvotes: 4

Related Questions