Skip to content

Commit 96caaf3

Browse files
nrcdtrswrz
andauthored
Update prod-stackit/terraform/50_projects/opsstack-agent-test-server/main.tf
Co-authored-by: Roman Schwarz <rswrz@users.noreply.github.com>
1 parent ea513ea commit 96caaf3

File tree

1 file changed

+5
-3
lines changed
  • prod-stackit/terraform/50_projects/opsstack-agent-test-server

1 file changed

+5
-3
lines changed

prod-stackit/terraform/50_projects/opsstack-agent-test-server/main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ exec bash linux-${var.agent_version}.sh
119119
# wait a minute for the server agent to be online
120120
command = join("; ", [
121121
"sleep 60s",
122-
"printf '%s' \"$TF_VAR_stackit_service_account_key\" > ${path.cwd}/key.json",
123-
"stackit auth activate-service-account --service-account-key-path ${path.cwd}/key.json",
124-
"rm ${path.cwd}/key.json",
122+
"tmpfile=$(mktemp)",
123+
"chmod 600 \"$tmpfile\"",
124+
"printf '%s' \"$TF_VAR_stackit_service_account_key\" > \"$tmpfile\"",
125+
"stackit auth activate-service-account --service-account-key-path \"$tmpfile\"",
126+
"shred --remove \"$tmpfile\"", # Note: On macOS, install coreutils to enable the `shred` command (e.g., via `brew install coreutils`)
125127
format(
126128
"stackit curl -X POST https://run-command.api.eu01.stackit.cloud/v1/projects/%s/servers/%s/commands --data ${jsonencode(self.triggers.body)}",
127129
data.stackit_resourcemanager_project.this.project_id,

0 commit comments

Comments
 (0)