<commit_before>#!/bin/bash -e

pushd `dirname "$0"` 

help() {
    echo "Usage: deploy.sh <environment> <ami name>"
    exit 0
}

case "$1" in
    "--help"|"-h"|"" ) help;;
esac

if [ $# -ne 2 ]
then
    help
fi

APP_ENVIRONMENT=$1
AMI_ID=$2

case "$APP_ENVIRONMENT" in
    "dev"|"prod" ) ;;
    * ) echo "environment must be either \"dev\" or \"prod\"" && exit 1;;
esac

terraform remote config \
    -backend=S3 \
    -backend-config="bucket=doge-application" \
    -backend-config="key=terraform/${APP_ENVIRONMENT}-env-terraform.tfstate" \
    -backend-config="region=us-east-1"

terraform plan -var ami_id=$AMI_ID providers/aws/us_east_1_$APP_ENVIRONMENT
terraform apply -var ami_id=$AMI_ID providers/aws/us_east_1_$APP_ENVIRONMENT

popd
<commit_msg>Push into terraform modules directory when running<commit_after>#!/bin/bash -e

pushd `dirname "$0"` 

help() {
    echo "Usage: deploy.sh <environment> <ami name>"
    exit 0
}

case "$1" in
    "--help"|"-h"|"" ) help;;
esac

if [ $# -ne 2 ]
then
    help
fi

APP_ENVIRONMENT=$1
AMI_ID=$2

case "$APP_ENVIRONMENT" in
    "dev"|"prod" ) ;;
    * ) echo "environment must be either \"dev\" or \"prod\"" && exit 1;;
esac

pushd "providers/aws/us_east_1_$APP_ENVIRONMENT"
terraform remote config \
    -backend=S3 \
    -backend-config="bucket=doge-application" \
    -backend-config="key=terraform/${APP_ENVIRONMENT}-env-terraform.tfstate" \
    -backend-config="region=us-east-1"

terraform plan -var ami_id=$AMI_ID
terraform apply -var ami_id=$AMI_ID
popd

popd

{'fraction_non_alphanumeric': 0.16282135794330915, 'fraction_numerical': 0.013843111404087014, 'mean_word_length': 3.6, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6570529', 'n_tokens_mistral': 616, 'n_tokens_neox': 606, 'n_words': 129}