4 ms·
Terraform often beats CloudFormation to the punch for support of AWS services. Terraform is also far more friendly in terms of being able to preview what's goin
by skywhopper 10y ago
Terraform often beats CloudFormation to the punch for support of AWS services. Terraform is also far more friendly in terms of being able to preview what's going to happen and roll things back. If Cloudformation fails, it's really hard to fix, and too often you need to contact AWS to unstick a CF change. Basically you have no control over the process and you just have a poor web UI or a poorer API to interact with. When Terraform fails, the newest version gives you tools to edit and update your state and import existing resources, and even when things get ugly you are still in total control. In short, I have no reservations about endorsing Terraform over Cloudformation.
- toomuchtodo 10y agoI just wanted to offer the other side. I do devops, we use Terraform, and we've had times when Terraform took action that was not present in the plan generated before applying, in production environments. We've also had times when it'll fail mid-apply, be stuck in an inconsistent state (IAM profiles and autoscaling group configurations, specifically), and require manual recovery through modifying or removing resources via the AWS console (although this might be better in the latest version). We'll continue to use Terraform at my day job, but I don't recommend it to colleagues nor clients if they use only AWS resources. Simplicity is the ultimate sophistication, and adding yet another abstraction does not contribute towards that philosophy.
- mitchellh 10y agoWe consider these kinds of issues the highest priority and always work to resolve this ASAP. The resolutions very often include not only the fix but protections to ensure that unintended actions don't bypass anything in the future. It's really unfortunate you had these experiences and I can't back up the statement when I say that this isn't normal and every release certainly does improve stability in a big way. Terraform is a very, very heavily tested (unit + acceptance) project and we fight very hard against regressions with multiple tests per bug in many cases at different levels. I'd encourage you to continue giving future versions a shot and if you experience anything like this again, let us know and we'll react to that quickly relative to other types of issues.
- toomuchtodo 10y agoThanks for the reply Mitchell! Definitely don't want my criticism to come off as unconstructive. As I mentioned, we'll continue to use Terraform; I'm optimistic it'll improve as Hashicorp iterates. I'm just naturally conservative coming from an ops background. I try to pick boring technologies that are battle tested through years of tech sector use; there's no glory for being on the bleeding edge, with only pain when things go south. So goes the ops struggle.
- mattdeboard 10y agoYes to all this. MIGBY, we have also been bitten in production in much the same way. If you are using only AWS resources there is no need to use terraform. Using it at all seems like a questionable decision to me since it's still firmly in "early adopters only" status. If you're AWS-only then CloudFormation is the way to go. And IMO it will continue to be for a long time, until terraform is much more battle-tested and -hardened. Unless of course you're operating in an environment where you can afford to be exposed to the cutting edge of infrastructure-as-code. I definitely am not.
- eropple 10y agoThis matches my experiences, and my own recommendations. Multiple clients of mine have independently coined "terrafucked" for when Terraform frags its state. It's usually recoverable but it shouldn't under any circumstance happen, and regardless of my other beefs with Terraform (which, to be fair, aside from the quiet insanity of HCL, seem to be decreasing!) because of that risk profile alone I can't recommend it for AWS-only clients right now. Personally, I use CloudFormation for my own stuff, because aside from reliability concerns, giving up on cfn-init to not write JSON (when I don't now, I use cfer, a Ruby DSL) is totally no bueno for me. Terraform offers no direct equivalent, though I've had HashiCorp sales people try to push Consul chewing-gum solutions that I'd have to manage much more directly than CFN metadata/cfn-init have been for me. Maybe in a couple years it'll be somewhere where I feel safer recommending it.
- snom380 10y agoThat's not true anymore. Cloudformation supports change sets that you can apply, similar to Terraform. They're not really human readable, but they're there. They also allow you to manually get out of the UPDATE_ROLLBACK_FAILED state, which was usually where you needed to contact AWS. Cloudformation also supports Lifecycle events. They are a bit complicated to set up right, but they allow you to tell CloudFormation how to wait and how to proceed in response to resource signals (for instance, the deployment can wait or roll back if new instances in an ASG fail to be deployed). Terraform has none of that. It has "create before destroy", and "depends on", but that's about it AFAIK. If CloudFormation fails it will at least attempt to roll back to a sane state (and usually succeeds). Terraform will give up and leave you to clean up the mess. Apart from that, Terraform has an advantage because of the modularity, ability to easily bring resources in, reference other resources in remote states etc.
- nikolay 10y agoTerraform was built using CloudFormation as the inspiration, but development became stale quickly and, at the same time, CloudFormation introduced some unique features. Given Lambda and Custom Resources, you can manage foreign to AWS resources now, and CloudFormation does not run on a single machine, but on multiple ones, I will speculate, using Simple Workflow Service. So, I pick CloudFormation as a reliable serverless service; I generate the JSON using troposphere, and I'm more than happy - HCL, which pretty much nobody outside of HashiCorp uses, can't beat Python! I am also not sure how viable HashiCorp is as their business model is strange and the sudden death of Vagrant should be a lesson learned!