Skip to content

Commit

Permalink
cleanup files created by deploy.sh #192 (#199)
Browse files Browse the repository at this point in the history
* cleanup files created by deploy.sh #192

* removing all components .tfvars files

* used explicit tiers instead of '*'

* added function to delete files in dir by name

* changed order file deletes

* Update src/clean.sh

Adding the word INFO for consistency.

Co-authored-by: Glenn Musa <[email protected]>

Co-authored-by: jjansen23 <[email protected]>
Co-authored-by: Glenn Musa <[email protected]>
  • Loading branch information
3 people authored May 11, 2021
1 parent 26a0277 commit 94e0a74
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ echo "INFO: destroying Terraform using ${mlz_config_file} and ${tfvars_path}..."
"${tfvars_path}" \
"y"

#function to remove files wherever they exist
delete_files_in_directory_by_name() {
directory_to_search=$1
file_name_to_match=$2

matches=$(find "$directory_to_search" -type f -name "$file_name_to_match")

for match in $matches
do
echo "INFO: deleting $match ..."
rm -f "$match"
done
}

# clean up MLZ config resources
delete_files_in_directory_by_name "$this_script_path" "$tfvars_filename"
echo "INFO: cleaning up MLZ resources with tag 'DeploymentName=${mlz_env_name}'..."
. "${this_script_path}/scripts/config/config_clean.sh" "${mlz_config_file}"
rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path:?}/${tfvars_filename}"

0 comments on commit 94e0a74

Please sign in to comment.