Open adrianhall opened 8 months ago
@wbreza added to Germanium bucket. Feel free to pull it into respective milestones.
This is by design. Any pre
hook scripts run before any of the associated commands.
Figured it would be by design - which means the question is "Can we please have a hook that is "post-confirmation-and-predown"? Not sure what you would call it - "preresourcedeletion" maybe?
@adrianhall - I'm not an expert on the budgets / diagnostic settings you are using - but is there a way these can be represented in your bicep so that they are cleaned up correctly?
The call to azd down
is basically the initial acceptance that you want to remove the resources provisioned by azd
. The confirmation is to just confirm that there were any manually added resources that should not be deleted.
Maybe the real question is do you have a use case where a user runs azd down
but then ops out of confirming the deletion?
Unfortunately, no. They are already represented in the bicep for creation, but there is an ordering issue with deletions. Budgets and diagnostic settings are the most common settings here. Another one is in network isolated environments where you need to depeer a pair of vnets prior to deleting (otherwise there is an unresolvable dependency chain). The point being - there are multiple reasons why you need to script things prior to running the azd down portion.
For your other question: If you don't have a use case where a user runs azd down and then opts out, why do you give the user the option to opt out confirming the deletion? If you have the opt-out available, then the templates should support opting out.
Output from
azd version
Runazd version
and copy and paste the output here:Describe the bug
We have a predown hook that removes budgets and diagnostic settings - things that are not handled by the normal "down" procedure and need to be sequenced. However, the predown hook is run prior to the confirmation dialog, meaning that the user is left with a broken deployment if they answer "no" to the azd down prompt.
Note that the output of our predown script is executed before the question about continuing. Since we cannot delete the budgets and diagnostic settings after the resource groups have been removed, this is a problem that leaves dangling resources.
To Reproduce Create a predown script with some output to show off the sequencing.
Expected behavior I expect to be able to configure a hook that is run only after the confirmation that we want to do something. This can be a new hook or by moving the existing predown hook.
Environment Information on your environment:
Additional context Internal (to Microsoft) repro is available if you prefer.