File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed
Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ terraform {
44 source = " hashicorp/google"
55 version = " 5.34.0"
66 }
7+ archive = {
8+ source = " hashicorp/archive"
9+ version = " ~> 2.2"
10+ }
711 }
812}
913#
@@ -67,7 +71,6 @@ locals {
6771 function_export_csv_zip = " ${ path . module } /../../functions-python/export_csv/.dist/export_csv.zip"
6872
6973 function_tasks_executor_config = jsondecode (file (" ${ path . module } /../../functions-python/tasks_executor/function_config.json" ))
70- function_tasks_executor_zip = " ${ path . module } /../../functions-python/tasks_executor/.dist/tasks_executor.zip"
7174}
7275
7376locals {
@@ -221,10 +224,26 @@ resource "google_storage_bucket_object" "reverse_geolocation_zip" {
221224}
222225
223226# 14. Task Executor
227+ # Create zip file from source directory
228+ data "archive_file" "tasks_executor_zip" {
229+ type = " zip"
230+ source_dir = " ${ path . module } /../../functions-python/tasks_executor"
231+ output_path = " ${ path . module } /../../functions-python/tasks_executor/tasks_executor.zip"
232+ excludes = [
233+ " tests/**" ,
234+ " **/__pycache__/**" ,
235+ " **/*.pyc" ,
236+ " .dist/**" ,
237+ " main_local_debug.py" ,
238+ " .coveragerc" ,
239+ " requirements_dev.txt"
240+ ]
241+ }
242+
224243resource "google_storage_bucket_object" "tasks_executor_zip" {
225244 bucket = google_storage_bucket. functions_bucket . name
226- name = " task-executor-${ substr (filebase64sha256 (local . function_tasks_executor_zip ) , 0 , 10 )} .zip"
227- source = local . function_tasks_executor_zip
245+ name = " task-executor-${ substr (data . archive_file . tasks_executor_zip . output_base64sha256 , 0 , 10 )} .zip"
246+ source = data . archive_file . tasks_executor_zip . output_path
228247}
229248
230249# Secrets access
You can’t perform that action at this time.
0 commit comments