News for hackers. Stuff that matters.
Re:I made a mistake with Terraform and Azure made it worse by terom on Friday July 09, 2021 @02:32AM (#27780998)
That just means that enabling `prevent_destroy` later on will a) destroy the resource b) create a new resource with a different name and `prevent_destroy` enabled.

Plus the combinatorial explosion of all possible conditions.

Not a good trick.

Re:I made a mistake with Terraform and Azure made it worse by usr1106 on Friday July 09, 2021 @11:57AM (#27785026)
Why would I want to enable it later? When I deploy production they ave enable_destroy. It's the same resource all the time and it must not be destroyed.

When I want to deploy a test system the resource can be destroyed after I am done.

Of course this is not really elegant code. It violates DRY, I need to make sure that my test resources have identical configuration as my production resources, except this one attribute.

Maybe your use case is different. I never change the prevent_destroy attribute during the lifetime of the resource.