3 ms·
What I don't like about Terraform is that the state of your resources is stored locally, which might lead to consistency problems depending on your setup. With
by Dunedan 8y ago
What I don't like about Terraform is that the state of your resources is stored locally, which might lead to consistency problems depending on your setup. With CloudFormation state is handled by CloudFormation itself, so you can be confident that stack updates operate on the latest state.
- artellectual 8y agoYou can store the state remotely there are many options for state storage too. You can use s3 or dynamo db or even create your own web service that accepts web hooks from terraform.
- Dunedan 8y agoOf course you can implement/set up syncing of state on your own, but that's something you don't have to worry about when using CloudFormation. I'm not sure how the options for Terraform handle race conditions when trying to deploy updates in parallel, but again, something you don't have to worry about with CloudFormation.
- dcu 8y agono, you and your team have to worry about not making a change that could render your whole stack useless
- nawitus 8y agoThis "implementing/setting up syncing of state" requires only a few lines of Terraform config.
- deboflo 8y agoLines of code is irrelevant when you are in the middle of a production deploy and you just want the highest visibility into what is going on. In cloudformation, there are only two possible places for resource state: 1) The actual resource state in AWS and 2) The desired state stored in CloudFormation.
- deboflo 8y ago"there are many options for state storage too" Just, no.
- cmonfeat 8y agoThat's only the default. Terraform supports storing state remotely, with locking. Most folks I know who use Terraform at scale recommend using this feature (if they store state at all).
- Dunedan 8y agoThanks for the information. Apparently my knowledge about state handling in Terraform did predate the introduction of remote state. I should've checked that first.
- deboflo 8y agoThen choosing where and how to store state using Terraform becomes another point of possible inconsistency in your infrastructure and thing to worry about. In CloudFormation, the state is coupled with the service, and you don't have to worry about it. It just works.
- dcu 8y agoadditionally you can run it from a single management host (or Jenkins), for example, so the state is always up to date
- liveoneggs 8y agoI store terraform state in s3 with dynamodb locking. It looks like this: #backend/state uses less priv keys terraform { backend "s3" { bucket = "mystatebucketisunique-tf" key = "states/tf/tf.tfstate" region = "us-east-1" lock_table = "lock-tf" profile = "aws_tf_s3-prof" } } So for an entirely new env I have to setup that bucket and the dynamodb table
- deboflo 8y agoExactly. This is a HUGE point of interest that, in complex multi AWS account or multi region scenarios, can make or break your infrastructure.