From 704e644b88f1b2839214b15bacf9ff472ef4646e Mon Sep 17 00:00:00 2001 From: Ben Rady Date: Mon, 29 Feb 2016 16:23:51 -0600 Subject: [PATCH] Fixed timing issue when creating IAM role for Lambda --- sspa | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sspa b/sspa index 464902ba9..cd3eb3943 100755 --- a/sspa +++ b/sspa @@ -239,7 +239,12 @@ function create_lambda_service() { local service_dir=${1%/} local function_name=$(basename $service_dir) create_iam_role lambda_exec "file://conf/iam/policies/lambda_trust.json" - local role_arn=$(support/jsed.py conf/iam/roles/learnjs_lambda_exec/info.json 'Role.Arn') + echo -n "Waiting for IAM Role to become available..." + local role_arn=$(support/jsed.py conf/iam/roles/${app_name}_lambda_exec/info.json 'Role.Arn') + while ! aws iam get-role --role-name ${app_name}_lambda_exec &> /dev/null; do + echo -n . + done + echo "...done!" if [[ ! -e ${service_dir}/info.json ]]; then aws --profile $profile lambda create-function \ --function-name ${function_name} \