-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Destroy previously created resources before re-running bin/setup (#294)
- Loading branch information
1 parent
f72ea47
commit 391d857
Showing
5 changed files
with
77 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
destroy_backend_state_resources.py destroys the Terraform backend state resources that are used to track | ||
resources created in the cloud provider during deployment. You may wish to destroy the backend state resources | ||
if they get corrupted. | ||
""" | ||
from typing import List | ||
|
||
from cloud.shared.bin.lib.config_loader import ConfigLoader | ||
from cloud.shared.bin.lib.setup_class_loader import get_config_specific_setup | ||
|
||
|
||
def run(config: ConfigLoader, params: List[str]): | ||
template = get_config_specific_setup(config) | ||
resources = template.detect_backend_state_resources() | ||
if resources['bucket'] or resources['table']: | ||
print(' - Found resources to destroy. Destroying backend resources...') | ||
if template.destroy_backend_resources(resources): | ||
print('Successfully destroyed backend state resources.') | ||
else: | ||
print( | ||
'One or more errors occurred when attempting to delete Terraform backend state resources. Please check your cloud provider\'s console for more information.' | ||
) | ||
else: | ||
print('No backend state resources found to destroy.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters