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
# Run tf with echo tf-workspace | |
tf_with_tf_workspace() { | |
if [[ "$@" == "apply" ]] || [[ "$@" == "output" ]]; | |
then | |
\terraform workspace list; | |
fi | |
\terraform "$@"; | |
} | |
alias tf="terraform" |
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
find -name 'requirements.txt' | xargs cat | sort | uniq > python_packages.txt && sed -i 's/[=<>].*$//g' python_packages.txt && uniq python_packages.txt && pip install -r python_packages.txt && cat python_packages.txt | xargs -d $'\n' sh -c 'for arg do pip show $arg | grep -v -e "^Location:" -e "^Requires:" -e "^Required-by:"; echo; done' > summary_python_packages.txt |
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 | |
# Download AWS lambda function package | |
# Add to ~/.bashrc | |
getLambda() { | |
functionName=$1 | |
awsProfile=${2:-default} | |
echo "Getting lambda function $functionName on account $awsProfile" |
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
# Grep default options | |
GREP_OPTIONS='--color=auto --exclude=*.pyc --exclude-dir=.git --exclude-dir *node_modules* --exclude-dir *.serverless* --exclude-dir *.requirements* --exclude-dir *.terraform*' | |
alias grep="grep $GREP_OPTIONS" | |
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
docker run -it --entrypoint /bin/sh $(docker images --format "{{.ID}}" | head -n 1) |
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
alias docker_rm_all_containers="docker ps -aq | xargs docker rm -f" | |
alias docker_rm_all_images="docker images -q | xargs docker rmi -f" |
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
version: 0.2 | |
phases: | |
pre_build: | |
commands: | |
# Hack to fix the symlinks that Codepipeline breaks | |
# Applies to .tf files that contain only 1 line | |
- for file in *.tf ; do awk 'NR==2{exit}END{exit NR!=1}' "$file" && sh -c "cat $file | xargs -I R2 ln -sf R2 $file"; done | |
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
PROFILE=foo | |
ACCOUNT_ID=123456 | |
ROLE=terraform | |
aws sts assume-role --role-arn arn:aws:iam::$ACCOUNT_ID:role/$ROLE --role-session-name "foo" > token | |
aws configure --profile $PROFILE set aws_session_token $(jq < token '.Credentials.SessionToken' -r) | |
aws configure --profile $PROFILE set aws_access_key_id $(jq < token '.Credentials.AccessKeyId' -r) | |
aws configure --profile $PROFILE set aws_secret_access_key $(jq < token '.Credentials.SecretAccessKey' -r) |
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
find . -type f -cmin -1 # dry run | |
find . -type f -cmin -1 -delete |
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
module "build" { | |
source = "git::https://github.com/cloudposse/terraform-aws-codebuild.git?ref=master" | |
privileged_mode = "true" | |
build_image = "docker.io/medwig/terraform_serverless:latest" | |
source_location = "https://github.com/your/repo" | |
source_type = "GITHUB" | |
} |
NewerOlder