Ensure /test-destroy-env also destroys management RG when core RG is absent#4925
Ensure /test-destroy-env also destroys management RG when core RG is absent#4925Copilot wants to merge 3 commits into
Conversation
|
/test |
|
🤖 pr-bot 🤖
(in response to this comment from @rudolphjacksonm) |
|
/test 2a69a8e |
|
🤖 pr-bot 🤖 🏃 Running tests: https://github.com/microsoft/AzureTRE/actions/runs/27072873570 (with refid (in response to this comment from @rudolphjacksonm) |
|
/test-destroy-env |
|
Destroying branch test environment (RG: rg-trea6436f6c)... (run: https://github.com/microsoft/AzureTRE/actions/runs/27084269577) |
|
Destroying PR test environment (RG: rg-treb80dde45)... (run: https://github.com/microsoft/AzureTRE/actions/runs/27084269577) |
|
Branch test environment destroy complete (RG: rg-trea6436f6c) |
|
PR test environment destroy complete (RG: rg-treb80dde45) |
There was a problem hiding this comment.
Pull request overview
Updates the /test-destroy-env deletion script to correctly clean up all TRE-related resource groups (including -mgmt) even when the core resource group (rg-tre<ref>) has already been deleted, preventing leftover management resources/state.
Changes:
- Resolve and cache all resource groups matching the core prefix up front; only exit early when none exist.
- Gate “core RG only” cleanup steps (locks, diagnostics, key vault handling, log analytics linked storage) on the core RG actually existing.
- Reuse the cached matching RG list for the final per-RG purge/delete loop to keep selection consistent.
What is being addressed
/test-destroy-envexited early if the core RG (rg-tre<ref>) was already gone, so prefixed groups likerg-tre<ref>-mgmtwere left behind. This left management-state resources undeleted and could preserve stale Terraform state locks.How is this addressed
Destroy scope resolution
Core-only cleanup gating
Deletion path reuse