make private key optional
Setting private_key to null uses the local ssh-agent as a fallback for authentication. Using the public_key instead of the private_key for ssh -i lets the agent select the right identity if loaded. tested with a yubikey
This commit is contained in:
@@ -27,7 +27,8 @@ resource "hcloud_server" "control_planes" {
|
||||
|
||||
connection {
|
||||
user = "root"
|
||||
private_key = file(var.private_key)
|
||||
private_key = var.private_key == null ? null : file(var.private_key)
|
||||
agent_identity = var.private_key == null ? file(var.public_key) : null
|
||||
host = self.ipv4_address
|
||||
}
|
||||
}
|
||||
@@ -38,7 +39,8 @@ resource "hcloud_server" "control_planes" {
|
||||
|
||||
connection {
|
||||
user = "root"
|
||||
private_key = file(var.private_key)
|
||||
private_key = var.private_key == null ? null : file(var.private_key)
|
||||
agent_identity = var.private_key == null ? file(var.public_key) : null
|
||||
host = self.ipv4_address
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user