From dda55a316b66e0df038c1f1eade4c5bbea3573ec Mon Sep 17 00:00:00 2001 From: Mateusz Borowski <45963093+mateuszborowskiep@users.noreply.github.com> Date: Wed, 13 Mar 2024 12:08:03 +0100 Subject: [PATCH] Change template_file depraced function vm.tf template_file is derpaced replaced by templatefile() function --- gcp/vm.tf | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/gcp/vm.tf b/gcp/vm.tf index 1a74655..c159c1f 100644 --- a/gcp/vm.tf +++ b/gcp/vm.tf @@ -1,16 +1,14 @@ # Startup script template -data "template_file" "startup_script" { - template = file("../userdata/installation-wrapper-script.sh") - # The wrapper script is used by each of the providers and each variable has to be filled out in order to run. Unfortunately, this means that if you change something in one provider, you have to change it in each of the others. It's not ideal, but FYI. - vars = { - "account_name" = "only for azure" - "cloud" = "gcp" - "connection_string" = "only for azure" - "connectors_script_name" = "opencti-connectors.sh" - "install_script_name" = "opencti-installer.sh" - "login_email" = var.login_email - "storage_bucket" = var.storage_bucket - } +locals { + startup_script = templatefile("${path.module}/../userdata/installation-wrapper-script.sh", { + account_name = "only for azure" + cloud = "gcp" + connection_string = "only for azure" + connectors_script_name = "opencti-connectors.sh" + install_script_name = "opencti-installer.sh" + login_email = var.login_email + storage_bucket = var.storage_bucket + }) } resource "google_compute_instance" "opencti_instance" { @@ -27,7 +25,7 @@ resource "google_compute_instance" "opencti_instance" { } # Startup script - metadata_startup_script = data.template_file.startup_script.rendered + metadata_startup_script = local.startup_script network_interface { network = "default"