From cc7724c4b0570f2845f68eeb52f85dbe52ab4196 Mon Sep 17 00:00:00 2001 From: Din Music Date: Sat, 6 Apr 2024 20:07:01 +0200 Subject: [PATCH] embed/terraform/modules/vm: Create .ssh directory if missing Signed-off-by: Din Music --- embed/terraform/modules/vm/vm.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embed/terraform/modules/vm/vm.tf b/embed/terraform/modules/vm/vm.tf index 21900fa1..eafefc26 100644 --- a/embed/terraform/modules/vm/vm.tf +++ b/embed/terraform/modules/vm/vm.tf @@ -143,7 +143,8 @@ resource "null_resource" "ssh_known_hosts" { provisioner "local-exec" { command = <<-EOF sh ./scripts/filelock-exec.sh \ - "touch $HOME/.ssh/known_hosts \ + "mkdir -p $HOME/.ssh + && touch $HOME/.ssh/known_hosts \ && ssh-keygen -R $VM_IP \ && ssh-keyscan -t rsa $VM_IP | tee -a $HOME/.ssh/known_hosts \ && rm -f $HOME/.ssh/known_hosts.old"