From fc6a94427c74dfed31904ed56c3723724af7872c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Din=20Mu=C5=A1i=C4=87?= Date: Sat, 6 Apr 2024 20:11:21 +0200 Subject: [PATCH] embed/terraform/modules/vm: Create .ssh directory if missing (#185) 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..cd08c31a 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"