#!/usr/bin/env bash

set -xeuo pipefail

# When changing this script, remember to modify the corresponding github action
vendor=${1}
env=${2}
region=${3}
logical_region=${4}
cluster=${5}

ROOT=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)

deploy_dir="${ROOT}/envs/${env}"
deploy_file="${deploy_dir}/regional-${vendor}-${logical_region}.yaml"

if [ -e ${deploy_file} ]; then
  aws cloudformation deploy \
    --region ${region} \
    --stack-name ${cluster}-access-log-bucket \
    --template-file ${deploy_file} \
else
  echo "Deploy file not found, skip it"
fi
