From 670137215453760285d39e818bea6f5c0439ff1d Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 13:16:23 -0500 Subject: [PATCH 01/11] so dank --- .automation/clean-code-base-for-tests.sh | 182 +++++++++++++++++++++++ .github/workflows/deploy-DEV.yml | 20 ++- 2 files changed, 199 insertions(+), 3 deletions(-) create mode 100755 .automation/clean-code-base-for-tests.sh diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh new file mode 100755 index 00000000..dd7c4510 --- /dev/null +++ b/.automation/clean-code-base-for-tests.sh @@ -0,0 +1,182 @@ +#!/usr/bin/env bash + +################################################################################ +############# Clean all code base for additonal testing @admiralawkbar ######### +################################################################################ + +########### +# Globals # +########### +GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace + +################################################################################ +############################ FUNCTIONS BELOW ################################### +################################################################################ +################################################################################ +#### Function Header ########################################################### +Header() { + info "-------------------------------------------------------" + info "------- GitHub Clean code base of error tests ---------" + info "-------------------------------------------------------" +} +################################################################################ +#### Function CleanTestFiles ################################################### +CleanTestFiles() { + info "-------------------------------------------------------" + info "Finding all tests that are supposed to fail... and removing them..." + + ################## + # Find the files # + ################## + FIND_CMD=($(cd "${GITHUB_WORKSPACE}" ; find . -type f -name "*_bad_*" 2>&1)) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + error "ERROR! failed to get list of all files!" + fatal "ERROR:[${FIND_CMD[*]}]" + fi + + ############################################################ + # Get the directory and validate it came from tests folder # + ############################################################ + for FILE in "${FIND_CMD[@]}"; do + ##################### + # Get the directory # + ##################### + FILE_DIR=$(dirname "$FILE" 2>&1) + + ################################## + # Check if from the tests folder # + ################################## + if [[ $FILE_DIR == **".automation/test"** ]]; then + ################################ + # Its a test, we can delete it # + ################################ + REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + error "ERROR! failed to remove file:[${FILE}]!" + fatal "ERROR:[${REMOVE_FILE_CMD[*]}]" + fi + fi + done +} +################################################################################ +#### Function CleanTestDockerFiles ############################################# +CleanTestDockerFiles() { + info "-------------------------------------------------------" + info "Finding all tests that are supposed to fail for Docker... and removing them..." + + ################## + # Find the files # + ################## + FIND_CMD=($(cd "${GITHUB_WORKSPACE}" ; find . -type f -name "*Dockerfile" 2>&1)) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + error "ERROR! failed to get list of all file for Docker!" + fatal "ERROR:[${FIND_CMD[*]}]" + fi + + ############################################################ + # Get the directory and validate it came from tests folder # + ############################################################ + for FILE in "${FIND_CMD[@]}"; do + ##################### + # Get the directory # + ##################### + FILE_DIR=$(dirname "$FILE" 2>&1) + + ################################## + # Check if from the tests folder # + ################################## + if [[ $FILE_DIR == **".automation/test/docker/bad"** ]]; then + ################################ + # Its a test, we can delete it # + ################################ + REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + error "ERROR! failed to remove file:[${FILE}]!" + fatal "ERROR:[${REMOVE_FILE_CMD[*]}]" + fi + fi + done +} +################################################################################ +#### Function RenameTestFolder ################################################# +RenameTestFolder() { + info "-------------------------------------------------------" + info "Need to rename [tests] folder as it will be ignored..." + + ##################### + # Rename the folder # + ##################### + RENAME_FOLDER_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; mv "${TEST_FOLDER}" "${CLEAN_FOLDER}" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + error "ERROR! failed to move test folder!" + fatal "ERROR:[${RENAME_FOLDER_CMD[*]}]" + fi +} +################################################################################ +################################## MAIN ######################################## +################################################################################ + +########## +# Header # +########## +Header + +#################### +# Clean test files # +#################### +CleanTestFiles + +############################### +# Clean the test docker files # +############################### +CleanTestDockerFiles + +################## +# Re Name folder # +################## +RenameTestFolder diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 7b524a22..db0d8036 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -50,9 +50,23 @@ jobs: shell: bash run: docker build --no-cache -t github/super-linter:${GITHUB_SHA} . - ################################ - # Run Linter against code base # - ################################ + ##################################### + # Run Linter against Test code base # + ##################################### - name: Run Test Cases shell: bash run: docker run -e RUN_LOCAL=true -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=tap -e OUTPUT_FOLDER=${GITHUB_SHA} -e OUTPUT_DETAILS=detailed -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${GITHUB_SHA} + + ######################################### + # Clean code base to run agaisnt it all # + ######################################### + - name: Clean Test code base for additional testing + shell: bash + run: .automation/clean-code-base-for-tests.sh + + ############################################ + # Run Linter against ALL cleaned code base # + ############################################ + - name: Run against all code base + shell: bash + run: docker run -e RUN_LOCAL=true -e OUTPUT_FORMAT=tap -e OUTPUT_FOLDER=${GITHUB_SHA} -e OUTPUT_DETAILS=detailed -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${GITHUB_SHA} From b601d7057b96a385e3a587ffc537345e6b5b5fec Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 13:22:34 -0500 Subject: [PATCH 02/11] mapfile --- .automation/clean-code-base-for-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index dd7c4510..abcbf356 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -28,7 +28,7 @@ CleanTestFiles() { ################## # Find the files # ################## - FIND_CMD=($(cd "${GITHUB_WORKSPACE}" ; find . -type f -name "*_bad_*" 2>&1)) + mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*_bad_*" 2>&1) ####################### # Load the error code # @@ -85,7 +85,7 @@ CleanTestDockerFiles() { ################## # Find the files # ################## - FIND_CMD=($(cd "${GITHUB_WORKSPACE}" ; find . -type f -name "*Dockerfile" 2>&1)) + mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*Dockerfile" 2>&1) ####################### # Load the error code # From 4f7a869dc78fd5759e3ecd41a409d17e5e5d0b52 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 13:32:23 -0500 Subject: [PATCH 03/11] source it --- .automation/clean-code-base-for-tests.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index abcbf356..4c7c0e71 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -9,6 +9,9 @@ ########### GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace +# shellcheck source=/dev/null +source "${GITHUB_WORKSPACE}/lib/log.sh" # Source the function script(s) + ################################################################################ ############################ FUNCTIONS BELOW ################################### ################################################################################ From c73d5c27e5593883d4e266ed317464ae694cee68 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 13:46:31 -0500 Subject: [PATCH 04/11] now with vars --- .automation/clean-code-base-for-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index 4c7c0e71..c90bc15e 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -8,7 +8,8 @@ # Globals # ########### GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace - +TEST_FOLDER='.automation/test' +CLEAN_FOLDER'.automation/automation' # shellcheck source=/dev/null source "${GITHUB_WORKSPACE}/lib/log.sh" # Source the function script(s) From a6fc5ea2f07d75a5a86aca36f302f4315ab0aa93 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 13:55:44 -0500 Subject: [PATCH 05/11] typo --- .automation/clean-code-base-for-tests.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index c90bc15e..f92e617a 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -9,7 +9,11 @@ ########### GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace TEST_FOLDER='.automation/test' -CLEAN_FOLDER'.automation/automation' +CLEAN_FOLDER='.automation/automation' + +############################ +# Source additonal scripts # +############################ # shellcheck source=/dev/null source "${GITHUB_WORKSPACE}/lib/log.sh" # Source the function script(s) From 4241daf621ff5a503e81b8731c6ca6a7145c7aa8 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 14:31:58 -0500 Subject: [PATCH 06/11] fixed bad var --- .automation/clean-code-base-for-tests.sh | 6 +++--- .github/workflows/deploy-DEV.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index f92e617a..c965f144 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -7,9 +7,9 @@ ########### # Globals # ########### -GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace -TEST_FOLDER='.automation/test' -CLEAN_FOLDER='.automation/automation' +GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace +TEST_FOLDER='.automation/test' # Folder where test are stored +CLEAN_FOLDER='.automation/automation' # Folder to rename to prevent skip ############################ # Source additonal scripts # diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index db0d8036..f25d355c 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -69,4 +69,4 @@ jobs: ############################################ - name: Run against all code base shell: bash - run: docker run -e RUN_LOCAL=true -e OUTPUT_FORMAT=tap -e OUTPUT_FOLDER=${GITHUB_SHA} -e OUTPUT_DETAILS=detailed -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${GITHUB_SHA} + run: docker run -e RUN_LOCAL=true -e OUTPUT_DETAILS=detailed -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${GITHUB_SHA} From 33f020ae4db6b5cbf2bd56a538fc8b1d3f5310de Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 15:01:51 -0500 Subject: [PATCH 07/11] fix powershell --- TEMPLATES/.arm-ttk.psd1 | 2 ++ TEMPLATES/.powershell-psscriptanalyzer.psd1 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/TEMPLATES/.arm-ttk.psd1 b/TEMPLATES/.arm-ttk.psd1 index bcddce85..329931c6 100644 --- a/TEMPLATES/.arm-ttk.psd1 +++ b/TEMPLATES/.arm-ttk.psd1 @@ -2,6 +2,8 @@ # - Test Parameters: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit#test-parameters # - Test Cases: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-cases @{ + # Version number of this module. + ModuleVersion = '0.0.1' # Test = @( # 'Parameters Property Must Exist', # 'Parameters Must Be Referenced', diff --git a/TEMPLATES/.powershell-psscriptanalyzer.psd1 b/TEMPLATES/.powershell-psscriptanalyzer.psd1 index f4bbd6b5..4f50a0e8 100644 --- a/TEMPLATES/.powershell-psscriptanalyzer.psd1 +++ b/TEMPLATES/.powershell-psscriptanalyzer.psd1 @@ -1,5 +1,7 @@ #Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/markdown/Invoke-ScriptAnalyzer.md#-settings @{ + # Version number of this module. + ModuleVersion = '0.0.1' #CustomRulePath='path\to\CustomRuleModule.psm1' #RecurseCustomRulePath='path\of\customrules' #Severity = @( From f88db68011380d81c5d0bf17c1bff3c7998e3d3a Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 6 Aug 2020 15:07:34 -0500 Subject: [PATCH 08/11] remove space --- .automation/clean-code-base-for-tests.sh | 31 ++++++++++++++++++++++++ lib/worker.sh | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index c965f144..9a7fe328 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -8,6 +8,7 @@ # Globals # ########### GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace +GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch TEST_FOLDER='.automation/test' # Folder where test are stored CLEAN_FOLDER='.automation/automation' # Folder to rename to prevent skip @@ -142,6 +143,31 @@ CleanTestDockerFiles() { done } ################################################################################ +#### Function CleanSHAFolder ################################################### +CleanSHAFolder() { + info "-------------------------------------------------------" + info "Cleaning folder named:[${GITHUB_SHA}] if it exists" + + ################## + # Find the files # + ################## + REMOVE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -rf "${GITHUB_SHA}" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + # Error + error "ERROR! Failed to remove folder:[${GITHUB_SHA}]!" + fatal "ERROR:[${REMOVE_CMD}]" + fi +} +################################################################################ #### Function RenameTestFolder ################################################# RenameTestFolder() { info "-------------------------------------------------------" @@ -184,6 +210,11 @@ CleanTestFiles ############################### CleanTestDockerFiles +############################### +# Remove sha folder if exists # +############################### +CleanSHAFolder + ################## # Re Name folder # ################## diff --git a/lib/worker.sh b/lib/worker.sh index 300355c9..a4a50fd3 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -604,7 +604,7 @@ function RunTestCases() { TestCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES}" ".*\.\(rb\)\$" "ruby" TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states" TestCodebase "TERRAFORM" "tflint" "tflint -c ${TERRAFORM_LINTER_RULES}" ".*\.\(tf\)\$" "terraform" - TestCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan -f " ".*\.\(tf\)\$" "terraform_terrascan" + TestCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan -f" ".*\.\(tf\)\$" "terraform_terrascan" TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${TYPESCRIPT_LINTER_RULES}" ".*\.\(ts\)\$" "typescript" TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin ${TYPESCRIPT_STANDARD_LINTER_RULES}" ".*\.\(ts\)\$" "typescript" TestCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "xml" From 8f258a0f8c463958a328d35d15f2e20a708bef44 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 7 Aug 2020 08:23:53 -0500 Subject: [PATCH 09/11] fix powershell again --- TEMPLATES/.arm-ttk.psd1 | 2 -- TEMPLATES/.powershell-psscriptanalyzer.psd1 | 2 -- 2 files changed, 4 deletions(-) diff --git a/TEMPLATES/.arm-ttk.psd1 b/TEMPLATES/.arm-ttk.psd1 index 329931c6..bcddce85 100644 --- a/TEMPLATES/.arm-ttk.psd1 +++ b/TEMPLATES/.arm-ttk.psd1 @@ -2,8 +2,6 @@ # - Test Parameters: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit#test-parameters # - Test Cases: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-cases @{ - # Version number of this module. - ModuleVersion = '0.0.1' # Test = @( # 'Parameters Property Must Exist', # 'Parameters Must Be Referenced', diff --git a/TEMPLATES/.powershell-psscriptanalyzer.psd1 b/TEMPLATES/.powershell-psscriptanalyzer.psd1 index 4f50a0e8..f4bbd6b5 100644 --- a/TEMPLATES/.powershell-psscriptanalyzer.psd1 +++ b/TEMPLATES/.powershell-psscriptanalyzer.psd1 @@ -1,7 +1,5 @@ #Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/markdown/Invoke-ScriptAnalyzer.md#-settings @{ - # Version number of this module. - ModuleVersion = '0.0.1' #CustomRulePath='path\to\CustomRuleModule.psm1' #RecurseCustomRulePath='path\of\customrules' #Severity = @( From b83490fc43ad8a0f8746e99c8e84f5a0cc1d2c95 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 7 Aug 2020 08:40:27 -0500 Subject: [PATCH 10/11] sudo? --- .automation/clean-code-base-for-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index 9a7fe328..eca46c92 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -151,7 +151,7 @@ CleanSHAFolder() { ################## # Find the files # ################## - REMOVE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -rf "${GITHUB_SHA}" 2>&1) + REMOVE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; sudo rm -rf "${GITHUB_SHA}" 2>&1) ####################### # Load the error code # From 2a162c85ab55f54eb7fb2963445ff60ac723c155 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 7 Aug 2020 09:09:40 -0500 Subject: [PATCH 11/11] saved the world --- .automation/clean-code-base-for-tests.sh | 65 +++++++++++++++++++ .../test/terraform/good/terraform_good_1.tf | 9 ++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/.automation/clean-code-base-for-tests.sh b/.automation/clean-code-base-for-tests.sh index eca46c92..9e22531c 100755 --- a/.automation/clean-code-base-for-tests.sh +++ b/.automation/clean-code-base-for-tests.sh @@ -192,6 +192,66 @@ RenameTestFolder() { fi } ################################################################################ +#### Function CleanPowershell ################################################## +CleanPowershell() { + # Need to remove the .psd1 templates as they are formally parsed, + # and will fail with missing modules + + info "-------------------------------------------------------" + info "Finding powershell template files... and removing them..." + + ################## + # Find the files # + ################## + mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*.psd1" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + error "ERROR! failed to get list of all file for *.psd1!" + fatal "ERROR:[${FIND_CMD[*]}]" + fi + + ############################################################ + # Get the directory and validate it came from tests folder # + ############################################################ + for FILE in "${FIND_CMD[@]}"; do + ##################### + # Get the directory # + ##################### + FILE_DIR=$(dirname "$FILE" 2>&1) + + ################################## + # Check if from the tests folder # + ################################## + if [[ $FILE_DIR == **"TEMPLATES"** ]]; then + ################################ + # Its a test, we can delete it # + ################################ + REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -ne 0 ]; then + error "ERROR! failed to remove file:[${FILE}]!" + fatal "ERROR:[${REMOVE_FILE_CMD[*]}]" + fi + fi + done +} +################################################################################ ################################## MAIN ######################################## ################################################################################ @@ -219,3 +279,8 @@ CleanSHAFolder # Re Name folder # ################## RenameTestFolder + +############################## +# Clean Powershell templates # +############################## +CleanPowershell diff --git a/.automation/test/terraform/good/terraform_good_1.tf b/.automation/test/terraform/good/terraform_good_1.tf index 1da458e4..59d24f7e 100644 --- a/.automation/test/terraform/good/terraform_good_1.tf +++ b/.automation/test/terraform/good/terraform_good_1.tf @@ -1,4 +1,9 @@ resource "aws_instance" "good" { - ami = "ami-0ff8a91507f77f867" - instance_type = "t2.small" + ami = "ami-0ff8a91507f77f867" + instance_type = "t2.small" + associate_public_ip_address = false + + ebs_block_device { + encrypted = true + } }