Skip to content

Commit

Permalink
[sdlf-utils] handle non-existing vpc support ssm parameter in legisla…
Browse files Browse the repository at this point in the history
…tors example
  • Loading branch information
cnfait committed Dec 2, 2024
1 parent 7bf5fc8 commit 678b9ea
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sdlf-utils/workshop-examples/legislators/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ then
fi
REGION=$(aws configure get region --profile "$PROFILE")

ARTIFACTS_BUCKET=$(aws --region "$REGION" --profile "$PROFILE" ssm get-parameter --name /sdlf/storage/rArtifactsBucket/dev --query "Parameter.Value" --output text)
ARTIFACTS_BUCKET=$(aws --region "$REGION" --profile "$PROFILE" ssm get-parameter --name "/sdlf/storage/rArtifactsBucket/dev" --query "Parameter.Value" --output text)
aws s3 cp "$DIRNAME/scripts/legislators-glue-job.py" "s3://$ARTIFACTS_BUCKET/artifacts/" --profile "$PROFILE"

mkdir "$DIRNAME"/output
Expand All @@ -35,8 +35,8 @@ function send_legislators()
{
ORIGIN="$DIRNAME/data/"

RAW_BUCKET=$(aws --region "$REGION" --profile "$PROFILE" ssm get-parameter --name /sdlf/storage/rRawBucket/dev --query "Parameter.Value" --output text)
KMS_KEY=$(aws --region "$REGION" --profile "$PROFILE" ssm get-parameter --name /sdlf/dataset/rKMSDataKey/dev --query "Parameter.Value" --output text)
RAW_BUCKET=$(aws --region "$REGION" --profile "$PROFILE" ssm get-parameter --name "/sdlf/storage/rRawBucket/dev" --query "Parameter.Value" --output text)
KMS_KEY=$(aws --region "$REGION" --profile "$PROFILE" ssm get-parameter --name "/sdlf/dataset/rKMSDataKey/dev" --query "Parameter.Value" --output text)

S3_DESTINATION=s3://$RAW_BUCKET/
COUNT=0
Expand All @@ -48,6 +48,12 @@ function send_legislators()
done
}

VPC_SUPPORT=$(aws --region "$REGION" --profile "$PROFILE" ssm get-parameter --name "/SDLF/VPC/Enabled" --query "Parameter.Value" --output text 2>/dev/null)
if [ -z "$VPC_SUPPORT" ]
then
aws --region "$REGION" --profile "$PROFILE" ssm put-parameter --name "/SDLF/VPC/Enabled" --value "false" --type String
fi

aws cloudformation package --template-file "$DIRNAME"/scripts/legislators-glue-job.yaml \
--s3-bucket "$ARTIFACTS_BUCKET" \
--profile "$PROFILE" \
Expand Down

0 comments on commit 678b9ea

Please sign in to comment.