refactor: skylab user ssh pub key as var
Some checks failed
Terraform Provision / Terraform Apply (push) Failing after 22s

This commit is contained in:
Ditmar Visser
2025-06-05 09:34:27 +00:00
parent 81bdd1b698
commit ce950908b6
3 changed files with 7 additions and 10 deletions

View File

@ -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
})
}

View File

@ -25,3 +25,7 @@ variable "prefix" {
description = "The Prefix used for all resources"
default = "week-5-opdracht-3"
}
variable "skylab_ssh_public_key" {
description = "Public key of the Skylab user"
}