4 ms·
It's a very powerful tool. Just like any other (well designed) tool, it's only going to do what the operator tells it to do. Terraform will never delete someth
by notwedtm 5y ago
It's a very powerful tool. Just like any other (well designed) tool, it's only going to do what the operator tells it to do.
Terraform will never delete something you don't tell it to.
- anonydsfsfs 5y ago> Terraform will never delete something you don't tell it to. Not necessarily. With some providers (e.g. Azure), Terraform will fail to recognize automated behind-the-scenes changes and try to revert them, causing serious breakage. This is why the "ignore_changes" meta-argument exists. See https://itnext.io/how-and-when-to-ignore-lifecycle-changes-in-terraform-ed5bfb46e7ae https://itnext.io/how-and-when-to-ignore-lifecycle-changes-i...
- throwaway290232 5y agoAlso why the create_before_destroy argument exists. Often you have to apply one or the other to a resource, or it simply falls into an infinite loop of creating and deleting the same resource.
- throwaway290232 5y agoActually that's impossible to know. Terraform doesn't delete anything at all. It asks provider plugins to remove a logical concept/placeholder, and the provider issues API calls (based on various criteria, some of which is not known until apply time, even with a plan run) and those API servers then do various things in the background based on criteria Terraform doesn't know about. Sometimes you need it to delete something, and it won't. And sometimes something else in the background gets removed by the provider or API service handling the first delete. Terraform is "powerful" in the sense that a 6'11 230lbs 30 year old blind man with an IQ of 85 is "powerful". And it's definitely not well designed, or there wouldn't be multiple large projects dedicated to fixing its many problems and missing features (terragrunt, terraformer, etc)