Skip to content

Commit

Permalink
feat: add awscli bin
Browse files Browse the repository at this point in the history
  • Loading branch information
seantrane committed Nov 1, 2024
1 parent fe4e419 commit aed785e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions bin/awscli
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
#
# Run OpenTofu as Docker Image
# https://opentofu.org/docs/intro/install/docker/

export AWSCLI_IMAGE="${AWSCLI_IMAGE:-"public.ecr.aws/aws-cli/aws-cli"}"
export AWSCLI_VERSION="${AWSCLI_VERSION:-"latest"}"

main() {
if [ "$(whoami)" == "runner" ]; then
: # echo "Don't execute in GitHub Actions workflow runs."
else
local OPTS=()
OPTS+=(--rm)
[[ -z "$PS1" ]] && OPTS+=(-it)
OPTS+=(-v ~/.aws:/root/.aws)
OPTS+=(-v "$(pwd):/aws")
[[ -n "${AWS_PROFILE:-}" ]] && OPTS+=(-e "AWS_PROFILE=$AWS_PROFILE")
docker run "${OPTS[@]}" "${AWSCLI_IMAGE}:${AWSCLI_VERSION}" "$@"
fi
}

main "$@"

0 comments on commit aed785e

Please sign in to comment.