diff --git a/.github/workflows/check_terraform.yaml b/.github/workflows/check_terraform.yaml index 1ee39f6f9..bb2a6eff8 100644 --- a/.github/workflows/check_terraform.yaml +++ b/.github/workflows/check_terraform.yaml @@ -68,7 +68,11 @@ jobs: - name: Check terrorm in ${{ matrix.target.name}} working-directory: terraform/subscriptions/scripts - run: SUBSCRIPTION=${{ matrix.target.subscription}} ENVIRONMENT=${{matrix.target.folderName}} ./terraform.sh + shell: bash + env: + SUBSCRIPTION: ${{ matrix.target.subscription}} + ENVIRONMENT: ${{matrix.target.folderName}} + run: ./terraform.sh - name: Revoke GitHub IP on StorageAccount if: ${{ steps.update_firewall.outcome == 'success' && !cancelled()}} # Always run this step even if previous step failed diff --git a/terraform/subscriptions/scripts/terraform.sh b/terraform/subscriptions/scripts/terraform.sh index a10666646..e699d3395 100755 --- a/terraform/subscriptions/scripts/terraform.sh +++ b/terraform/subscriptions/scripts/terraform.sh @@ -4,8 +4,8 @@ grn=$'\e[1;32m' yel=$'\e[1;33m' normal=$(tput sgr0) -if [[ -z "$ENVIROMENT" ]]; then - echo "ERROR: Please provide ENVIROMENT" >&2 +if [[ -z "$ENVIRONMENT" ]]; then + echo "ERROR: Please provide ENVIRONMENT" >&2 exit 1 fi @@ -14,12 +14,10 @@ if [[ -z "$SUBSCRIPTION" ]]; then exit 1 fi - - # Set the directory you want to search -# directory="../${SUBSCRIPTION}/${ENVIROMENT}" +# directory="../${SUBSCRIPTION}/${ENVIRONMENT}" # directory="../s940/dev/" -directory="../${SUBSCRIPTION}/${ENVIROMENT}" +directory="../${SUBSCRIPTION}/${ENVIRONMENT}" for dir in "$directory"/*; do if [ ! -d "$dir" ]; then continue; fi @@ -48,4 +46,4 @@ for dir in "$directory"/*; do if [ -n "$replace" ]; then echo -e "The following resources will be replaced:\n ${red}${replace}${normal}\n"; fi if [ -z "$create$destroy$update$replace" ]; then echo -e "No changes. Your infrastructure matches the configuration.\n"; fi rm "$dir/plan.out" -done \ No newline at end of file +done