Re:Terraform 0.15 General Availability
by encryptluks2 on Wednesday April 14, 2021 @09:13PM
(#26815110)
When using Terraform you should think of your IaC as the plans to build or rebuild your infrastructure, not an extension. I built mine in a way where I can destroy all the infrastructure in a plan and then reapply. You don't have to worry about rollbacks when you can just rebuild everything without affecting your end service.
[ Parent
| on HN ]
welcome to the real world where you sometimes cannot do what you are saying :(
What parent meant is that in CF if it encounters an error, by default will roll back to state before the update. TF will just leave it broken.
Re:Terraform 0.15 General Availability
by encryptluks2 on Thursday April 15, 2021 @07:57AM
(#26819304)
It isn't left broken per say, in fact you should be able to version the state and rollback to the previous state and have it remove whatever new resources were created when you re-apply.
I just take another approach which is if something doesn't work, then I'm able to quickly blow it away and re-deploy without affecting the end service by having the apply only target specific environments.
If it is half deployed it is broken, maybe in some cases service continues running, but in other will be broken.
The solution you mentioned relies on other tools and some manual work you need to do. Also with how TF works by default you might never be able to restore to exact same state as it was before.
CF when needs to replace a resource it first creates a new copy, and applies all changes if everything succeeds then it removes old resource, if it fails it rolls changes back.
You have an option that allows you to do that with a resource, but it's done individually per resource and it still isn't exactly the same thing.