Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change template_file depraced function vm.tf #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions gcp/vm.tf
Original file line number Diff line number Diff line change
@@ -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" {
Expand All @@ -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"
Expand Down