refactor: skylab user ssh pub key as var
Some checks failed
Terraform Provision / Terraform Apply (push) Failing after 22s
Some checks failed
Terraform Provision / Terraform Apply (push) Failing after 22s
This commit is contained in:
@ -1,18 +1,10 @@
|
||||
# ESXi
|
||||
|
||||
variable "skylab_ssh_public_key_path" {
|
||||
default = "/home/student/.ssh/skylab.pub"
|
||||
}
|
||||
|
||||
data "local_file" "ssh_key" {
|
||||
filename = var.skylab_ssh_public_key_path
|
||||
}
|
||||
|
||||
# Render userdata template with skylab SSH key
|
||||
data "template_file" "esxi_userdata" {
|
||||
template = file("${path.module}/userdata.tftpl")
|
||||
vars = {
|
||||
skylab-ssh-key = trimspace(data.local_file.ssh_key.content)
|
||||
skylab-ssh-key = trimspace(var.skylab_ssh_public_key)
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +42,7 @@ locals {
|
||||
inventory = templatefile("${path.module}/ansible-inventory.tmpl", {
|
||||
name = esxi_guest.les-5-opdracht-3.guest_name
|
||||
ip = esxi_guest.les-5-opdracht-3.ip_address
|
||||
private_key_file = var.skylab_ssh_public_key_path
|
||||
private_key_file = var.skylab_ssh_public_key
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user