Created
April 26, 2021 17:54
-
-
Save jasonmimick/660c4240380a5e767ced3c6b64f32e5e to your computer and use it in GitHub Desktop.
Helper for cfn dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "MongoDB Atlas CloudFormation Resource Devloper Docker Shell" | |
echo "-----------------------------------------------------------" | |
if [ -x "$(command -v mongocli)" ]; then | |
echo 'No apikey arguments detected and mongocli installed, will use default mongocli profile.' | |
MCLI_ARGS=$(./export-mongocli-config.py default spaces) | |
export MCLI_PUBLIC_API_KEY=$(echo ${MCLI_ARGS} | cut -d' ' -f1) | |
export MCLI_PRIVATE_API_KEY=$(echo ${MCLI_ARGS} | cut -d' ' -f2) | |
export MCLI_ORG_ID=$(echo ${MCLI_ARGS} | cut -d' ' -f3) | |
else | |
export MCLI_PUBLIC_API_KEY=${1} | |
export MCLI_PRIVATE_API_KEY=${2} | |
export MCLI_ORG_ID=${3} | |
fi | |
IMAGE_REPO=${IMAGE_REPO:-} | |
IMAGE=${IMAGE:-get-started-aws-cfn-sdk} | |
IMG="${IMAGE_REPO}${IMAGE}" | |
export ATLAS_PUBLIC_KEY="${MCLI_PUBLIC_API_KEY}" | |
export ATLAS_PRIVATE_KEY="${MCLI_PRIVATE_API_KEY}" | |
export ATLAS_ORG_ID="${MCLI_ORG_ID}" | |
echo "Running Docker image: ${IMG}" | |
echo "Executing ... " | |
env | grep MCLI | |
env | grep ATLAS | |
echo "-----------" | |
docker run -it --rm \ | |
-v $HOME/.aws:/root/.aws \ | |
-v $HOME/.config:/root/.config \ | |
-v get-started-aws:/cache \ | |
-v "$(pwd)":/workspace \ | |
-e MCLI_PUBLIC_API_KEY \ | |
-e MCLI_PRIVATE_API_KEY \ | |
-e MCLI_ORG_ID \ | |
-e ATLAS_PUBLIC_KEY \ | |
-e ATLAS_PRIVATE_KEY \ | |
-e ATLAS_ORG_ID \ | |
-e AWS_DEFAULT_REGION \ | |
-e AWS_ACCESS_KEY_ID \ | |
-e AWS_SECRET_ACCESS_KEY \ | |
-e AWS_SESSION_TOKEN \ | |
-w /workspace/ "${IMG}" \ | |
bash | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment