Hi, I can’t figure out how to specify multiple environment variables in the dpl to deploy a lambda.
I use .travis.yml to call a bash script (deploy.lambdas.sh) and have the environment variables in a bash variable. The docu says “List of Environment Variables to add to the function — type: string or array of strings” and it is unclear to me how to specify an “array of strings”
part of .travis.yml:
deploy:
- provider: script
edge: true
script: >-
bash deployConfig/deploy.lambdas.sh
part of deployConfig/deploy.lambdas.sh:
echo "using defaultEnvVars ${defaultEnvVars}"
echo "using customEnvVars ${customEnvVars}" # todo: fix multiple vars
# Deploy
echo "deploying lambda ${featureName}..."
dpl --provider="lambda" \
--access_key_id="${accessKey}" \
--secret_access_key="${secretKey}" \
--region="${awsRegion}" \
--function_name="${featureName}" \
--role="${lambdaRole}" \
--environment="${customEnvVars} ${defaultEnvVars}" \
--description="Travis build #$TRAVIS_BUILD_NUMBER ($TRAVIS_REPO_SLUG $TRAVIS_BRANCH $shortCommit)" \
--runtime="${runtime}" \
--zip="${zipFileDir}/${zipFileName}" \
--layers="${layerArns}" \
--timeout="${timeout}" \
--memory_size="${memorySize}" \
--handler_name="${handler}" || exit 1;
echo "done deploying lambda ${featureName}."
The log shows:
using defaultEnvVars vecfg={"envs":[{"name":"ve-cd-dev","awsAccountId":"[secure]","datalakeS3Bucket":"[secure]","slackWebhookUrl":"[secure]"}]}
using customEnvVars "datalakeEtlDataPrefix=etl" "datalakeRawDataPrefix=raw"
deploying lambda derControl...
Installing deployment dependencies
Installing gem dependencies: aws-sdk-lambda (~> 1.0), rubyzip (~> 1.2.2)
Using Access Key: AK******************
Setting the build environment up for the deployment
Updating existing function derControl.
1 validation error detected: Value at 'environment.variables' failed to satisfy constraint: Map keys must satisfy constraint: [Member must satisfy regular expression pattern: [a-zA-Z]([a-zA-Z0-9_])+]
Script failed with status #<struct Dpl::Provider::Status provider=Dpl::Providers::Script, status=:stable, info=nil>
failed to deploy
Any assistance is appreciated.
Thanks,
Hubert