From 702505f353aff2cd43f11fef2ac1292b6aa74a9a Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 4 Feb 2024 13:08:19 +0100 Subject: yandex/server: refactoring --- yandex/server/main.tf | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/yandex/server/main.tf b/yandex/server/main.tf index b9d4650..97b326f 100644 --- a/yandex/server/main.tf +++ b/yandex/server/main.tf @@ -3,6 +3,11 @@ locals { port = var.ssh_port users = [var.user] }) + user_data = templatefile("${path.module}/../../etc/cloud-init.cfg", { + user = var.user + ssh_keys = var.ssh_keys + sshd_config = local.sshd_config + }) } resource "yandex_compute_instance" "this" { @@ -30,11 +35,7 @@ resource "yandex_compute_instance" "this" { } metadata = { - user-data = templatefile("${path.module}/../../etc/cloud-init.cfg", { - user = var.user - ssh_keys = var.ssh_keys - sshd_config = local.sshd_config - }) + user-data = local.user_data } allow_stopping_for_update = true -- cgit v1.2.3