5 ms·
I’m a little unclear on terraform in practice. As you supposed to download this, use it’s language and syntax which is all it’s own thing, to define you servic
by SlowRobotAhead 7y ago
I’m a little unclear on terraform in practice.
As you supposed to download this, use it’s language and syntax which is all it’s own thing, to define you services and then export that to a YAML setup that AWS CloudFormation (for example) is expecting?
I assume there are reasons I wouldn’t just define it myself in YAML directly?
- s09dfhks 7y agothere's no exporting. You write everything in there format to define your infrastructure, and then terraform turns it into AWS API calls
- SlowRobotAhead 7y agoThat makes sense. Now, other than the portability of AWS to Azure to GCP, why do I want this? Because with CloudFormation I can pull down and put up my “stacks” in layers and this isn’t necessarily the same as API calls (although on the backend maybe it is).
- pseudalopex 7y agoTerraform can manage much more than AWS, Azure, and GCP.[1] [1] https://www.terraform.io/docs/providers/ https://www.terraform.io/docs/providers/
- NikolaeVarius 7y agoNo. It invokes infra changes directly, Cloudformation doesn't enter into this at all
- EdwardDiego 7y agoBasically Terraform is cloud agnostic, so you can (theoretically) define something in Terraform and then use it on AWS, or GCP, or Azure.
- merlincorey 7y agoThat's not at all how it works. Terraform supports each of those providers, but the resources are specific to each provider. You cannot use the same Terraform configuration on AWS and Azure. Nor would you want to, per se. As far as I know, this is by design.
- EdwardDiego 7y agoFair criticism, I've never used it, just what I've picked up from their marketing material.
- techntoke 7y ago> Basically Terraform is cloud agnostic, so you can (theoretically) define something in Terraform and then use it on AWS, or GCP, or Azure. > Fair criticism, I've never used it, just what I've picked up from their marketing material. LOL, why'd you even comment? You are making statements based on marketing material? Microsoft is probably hiring people like you if you're looking for a job.
- tedk-42 7y agoBahahahaha spot on.
- dang 7y agoPersonal attacks will get you banned here, regardless of how ignorant or annoying some other comment is. Please review the guidelines and follow them when posting to HN: https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- kitotik 7y agoYou can’t share provider-specific resources across providers of course, but you can absolutely share other configuration data across providers. I find it extremely useful - for example it’s fairly trivial to bounce between scaleway, AWS, DO, Vultr, etc.
- alexbanks 7y agoTerraform creates and manages changes for you. You should not be using Cloudformation or writing CF templates at all while using it.
- pensatoio 7y agoAs others have said, no exporting is involved. You write roughly-json-esque code which you then apply to a cloud provider. The state of the infrastructure is stored, ideally, in the cloud. You apply your code during which terraform identifies which changes need to be made by comparing the current state with your local changes and executes those changes as you watch. The end result is well-defined, testable, repeatable cloud infrastructure provisioning. Infrastructure as code. Store it in git. Profit.
- SlowRobotAhead 7y ago>Infrastructure as code. Store it in git. Profit. Ok. But so is CloudFormation YAML files, mostly. So is the advantage of Teraform that it works beyond AWS?
- dvcrn 7y agoFor me yes. I can do things like: Spinup a kubernetes cluster, add a deployment with the latest image from my docker registry, add a loadbalancer with an external IP and create a cloudflare A record for my domain with that IP - all within the same tool.
- SlowRobotAhead 7y agoOk, but if you are (as in my case) staying entirely in AWS dynamo, lambda, E3, and IoT Core... it seems less important. I never leave the AWS ecosystem at all. I’m not challenging what you do, just trying to figure out what makes sense for me.
- mirceal 7y agohuge difference between storing the infrastructure definition vs storing the infrastructure state. cloudformation manages the state for you and will not fuck it up / allow you to fuck it up
- 420codebro 7y agoMy opinion? Because CloudFormation is full of shit regarding "always being able to rollback". After dealing with a 100+ failed CF rollbacks, I stopped caring about that phantom feature. That's around the same time I started using Terraform. At this point I only use CF for things I can not put in TF directly - namely ASGs. Regarding IaC "rollback" capabilities - I don't think it really exists in a way that makes it reasonable for people to depend on. The path forward is to stand up new infrastructure, canary test, etc - then steer via load-balancers the traffic to your new nodes, and then finally destroy the old ones. I loathe trying to maintain a fleet of nodes that can drift into various states of dis-repair. I love the idea of blowing everything away and having a 100% clean and predictable environment again. It makes me happy. </end rant> Hope that helps - I really have fallen in love with Terraform after having to cobble down N number of CLI tools for various cloud providers, hypervisor providers, etc. Terraform at least gives an easy to use language and abstracts me above recursive API call logic that I would otherwise need to write for basic things.