use locals to deduplicate ssh key expressions

This commit is contained in:
phaer
2022-01-25 14:21:58 +01:00
parent 9bb945a302
commit 07ab83a09f
4 changed files with 22 additions and 14 deletions

View File

@@ -27,8 +27,8 @@ resource "hcloud_server" "control_planes" {
connection {
user = "root"
private_key = var.private_key == null ? null : file(var.private_key)
agent_identity = var.private_key == null ? file(var.public_key) : null
private_key = local.ssh_private_key
agent_identity = local.ssh_identity
host = self.ipv4_address
}
}
@@ -39,8 +39,8 @@ resource "hcloud_server" "control_planes" {
connection {
user = "root"
private_key = var.private_key == null ? null : file(var.private_key)
agent_identity = var.private_key == null ? file(var.public_key) : null
private_key = local.ssh_private_key
agent_identity = local.ssh_identity
host = self.ipv4_address
}
}