@@ -23,7 +23,10 @@ inputs:
23
23
description : ' The lifetime of the ephemeral instance, how long the instance should be available for'
24
24
required : false
25
25
default : ' 30'
26
-
26
+ configuration :
27
+ description : ' Configuration for the LocalStack environment to be created'
28
+ required : false
29
+ default : ' '
27
30
28
31
runs :
29
32
using : composite
70
73
autoLoadPod="${AUTO_LOAD_POD:-${{ inputs.auto-load-pod }}}"
71
74
extensionAutoInstall="${EXTENSION_AUTO_INSTALL:-${{ inputs.extension-auto-install }}}"
72
75
lifetime="${{ inputs.lifetime }}"
76
+ configuration='${{ inputs.configuration }}'
77
+
78
+ # Convert configuration to JSON format
79
+ IFS=',' read -r -a configArray <<< "$configuration"
80
+ envVarsJson=$(jq -n '{}')
81
+ for config in "${configArray[@]}"; do
82
+ IFS='=' read -r -a kv <<< "$config"
83
+ key=${kv[0]// /}
84
+ value=${kv[1]// /}
85
+ envVarsJson=$(echo $envVarsJson | jq --arg key "$key" --arg value "$value" '. + {($key): $value}')
86
+ done
87
+
88
+ envVarsJson=$(echo $envVarsJson | jq --arg autoLoadPod "$autoLoadPod" --arg extensionAutoInstall "$extensionAutoInstall" '. + {AUTO_LOAD_POD: $autoLoadPod, EXTENSION_AUTO_INSTALL: $extensionAutoInstall}')
73
89
74
90
list_response=$(curl -X GET \
75
91
-H "ls-api-key: ${LOCALSTACK_API_KEY:-${{ inputs.localstack-api-key }}}" \
85
101
https://api.localstack.cloud/v1/compute/instances/$previewName)
86
102
fi
87
103
88
- response=$(curl -X POST -d "{\"instance_name\": \"${previewName}\", \"lifetime\": ${lifetime} , \"env_vars\": {\"AUTO_LOAD_POD\": \"${autoLoadPod}\", \"EXTENSION_AUTO_INSTALL\": \"${extensionAutoInstall}\" }}"\
104
+ response=$(curl -X POST -d "{\"instance_name\": \"${previewName}\", \"lifetime\": ${lifetime}, \"env_vars\": ${envVarsJson }}"\
89
105
-H "ls-api-key: ${LOCALSTACK_API_KEY:-${{ inputs.localstack-api-key }}}" \
90
106
-H "content-type: application/json" \
91
107
https://api.localstack.cloud/v1/compute/instances)
0 commit comments