Closed EmAchieng closed 1 day ago
Conditional Deletion:
resources_created
dictionary to verify whether a resource was successfully created before attempting deletion. This ensures that only existing resources are targeted for removal, preventing redundant error messages.Improved Reliability:
resources_created
dictionary, the script enhances its reliability during the cleanup process. It avoids exceptions related to trying to delete resources that were never created, leading to a smoother execution flow.Cleaner Logs:
Description: The resources created in the
try
block are deleted in thefinally
block regardless of whether they were successfully created. This could lead to redundant or failed delete operations for resources that do not exist.Possible Fix: Use a resource tracking mechanism (like the resources_created dictionary) to ensure that only resources that were successfully created are deleted. This will prevent unnecessary error messages during the cleanup process.