Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add config_clean.sh as a way to clean up MLZ resources #159

Merged
merged 5 commits into from
Apr 16, 2021

Conversation

glennmusa
Copy link
Contributor

@glennmusa glennmusa commented Apr 15, 2021

Description

Provide a mechanism to clean up all the resources created by Mission LZ to support a deployment.

Issue reference

The issue this PR will close: #4, #150

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles or validates correctly
  • BASH scripts have been validated using shellcheck
  • All tests pass (manual and automated)
  • The documentation is updated to cover any new or changed features
  • Markdown files have been linted using the recommended linter. (See .vscode/extensions.json.)
  • Relevant issues are linked to this PR

Copy link
Contributor

@brooke-hamilton brooke-hamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything worked as designed.

Copy link
Contributor

@brooke-hamilton brooke-hamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, it looks like the cleanup script is deleting all the resources, including the hub and T0. That is not the intended behavior, right?

INFO: deleting rg-mlz-tf-mlz1618577267...
INFO: deleting rg-tf-sacahub-mlz1618577267...
INFO: deleting rg-tf-tier0-mlz1618577267...
INFO: deleting rg-tf-tier1-mlz1618577267...
INFO: deleting rg-tf-tier2-mlz1618577267...
INFO: deleting rg-saca-mlz1618577267...
INFO: deleting rg-t0-mlz1618577267...
INFO: deleting rg-t1-mlz1618577267...
INFO: deleting rg-t2-mlz1618577267...
INFO: deleting service principal sp-mlz-tf-mlz1618577267...
Removing role assignments
INFO: purging key vault mlzkvmlz1618577267d8f20d...
INFO: Complete! Resources for mlz1618577267 deleted!

@glennmusa
Copy link
Contributor Author

@brooke-hamilton you're right, let me update how MLZ Configuration resources are tagged.

@glennmusa
Copy link
Contributor Author

My mistake, it looks like the cleanup script is deleting all the resources, including the hub and T0. That is not the intended behavior, right?

INFO: deleting rg-mlz-tf-mlz1618577267...
INFO: deleting rg-tf-sacahub-mlz1618577267...
INFO: deleting rg-tf-tier0-mlz1618577267...
INFO: deleting rg-tf-tier1-mlz1618577267...
INFO: deleting rg-tf-tier2-mlz1618577267...
INFO: deleting rg-saca-mlz1618577267...
INFO: deleting rg-t0-mlz1618577267...
INFO: deleting rg-t1-mlz1618577267...
INFO: deleting rg-t2-mlz1618577267...
INFO: deleting service principal sp-mlz-tf-mlz1618577267...
Removing role assignments
INFO: purging key vault mlzkvmlz1618577267d8f20d...
INFO: Complete! Resources for mlz1618577267 deleted!

This should be fixed @brooke-hamilton

@brooke-hamilton
Copy link
Contributor

brooke-hamilton commented Apr 16, 2021

When I deployed everything to the same sub, this worked exactly as described.

This scenario did not work:

  1. Deploy with each tier and the config in a different subscription, like this:
  src/deploy.sh -s {my_mlz_configuration_subscription_id} \
    -h {my_hub_network_subscription_id} \
    -0 {my_identity_network_subscription_id} \
    -1 {my_operations_network_subscription_id} \
    -2 {my_shared_services_network_subscription_id} \
    -z {my_mlz_environment_name}
  1. Run config_clean.sh like this:
src/scripts/config/config_clean.sh src/generated-configurations/jbh002.mlzconfig 
INFO: deleting mlz-config-jbh002...
Resource group 'mlz-config-jbh002' could not be found.

@glennmusa
Copy link
Contributor Author

src/deploy.sh -s {my_mlz_configuration_subscription_id} \
    -h {my_hub_network_subscription_id} \
    -0 {my_identity_network_subscription_id} \
    -1 {my_operations_network_subscription_id} \
    -2 {my_shared_services_network_subscription_id} \
    -z {my_mlz_environment_name}

That makes sense. I'll update to use the correct subscription. Thanks!

@glennmusa glennmusa enabled auto-merge (squash) April 16, 2021 21:24
@glennmusa glennmusa merged commit e637a67 into main Apr 16, 2021
@glennmusa glennmusa deleted the glennmusa/cleanupmlzresources branch April 16, 2021 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tear-down automation for config resources
2 participants