nixos-anywhere/terraform/nixos-rebuild/main.tf
Jean-François Roche 16143cd8c0 terraform: allow nixos-rebuild to use specified private key for deployment
`nixos-rebuild/deploy.sh` script enable ssh authentication with a given private key
through the `SSH_KEY` environment variable.

Add additional variable for the private key used for the deployment.
To encourage the use of ssh-agent and discourage the storage of deployment keys in the terraform state
we do not set the install ssh key as the default for the deployment key.

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2023-03-28 00:28:48 +02:00

13 lines
312 B
HCL

resource "null_resource" "nixos-rebuild" {
triggers = {
store_path = var.nixos_system
}
provisioner "local-exec" {
environment = {
SSH_KEY = var.ssh_private_key
}
command = "${path.module}/deploy.sh ${var.nixos_system} ${var.target_user}@${var.target_host} ${var.target_port}"
}
}