Live data from Hacker News

Terraform 0.12

hashicorp.com

71–80 of 167 posts

Re: Terraform 0.12

#71
post #64
post #44

Earlier quoted context omitted.

Ansible can very easily, and often does, end up in situations where two runs of the same playbook both have drastically different results. roles/playbooks slowly become Bash scripts written in a YAML layer parsed as a Jinja2 template.. and the project turns into a mess of many layers of indirection. it attempts to and encourages declarative configuration, but is very hard to keep that way. it is difficult and require…

Maybe you never worked in a company with good ansible practices.

following best practices with C will get you code without memory leaks or overflow errors, yet here we are in 2019 still routinely dealing with those in mission critical software written by people who understand what they are doing.

Terraform is a tool designed to overcome the problems that "best practices" will supposedly prevent you from introducing in your Ansible playbook.

don't get me wrong. Ansible is a wonderful tool for certain applications (configuration management). I would just never use it to spin up infrastructure again.

Re: Terraform 0.12

#72
post #60
post #51

Earlier quoted context omitted.

this is short-sighted. Terraform and CloudFormation are not even in the same league. One of them works and actually can be used for Infrastructure as Code, the other one does not roll back in the face of failure - it effectively craps for reasons ranging from network failure, process crash, even normal operation. One is heavy kool-aid with bugs that go unresolved for years, the other behaves as advertised. Sorry, but…

I mean, this is harsh, but there's a running joke that the big feature terraform is missing is a -twice flag so that it'll re-run itself on failure, since that's what you end up having to do anyways. Also, the terraform language, HCL? It's, I guess there's no better way to put this: not good. Am I misunderstanding the complexity of what Terraform is trying to do? To me, it looks like a bunch of tiny API clients tied…

The most sensible way I’ve used TF was to create an api for others to consume, containing models of terraform modules.

Users can pick and chose what modules, how many and set some params which are then validated.

The components are then rendered as json, fully declarative, no counts, no fancy TF hacks.

Data sources and a couple of home grown providers take care of whatever needs to be dynamic.

This way a lot of foot-guns are removed for consumers, and it simplifies the whole thing. At the expense of writing some code... worth it though, in a more enterprisey setting.

Re: Terraform 0.12

#73

I've been chasing infrastructure-as-code for a while, but I keep getting blocked by Terraform missing provider APIs (GCP Cloud Function Runtimes outside Nodejs, most recently), Kubernetes complexity, and generally being too lazy to sit down and bang out something in code that I can quickly iterate on with a console or quick CLI commands. I've had some wins with Serverless Framework, but outside that I've yet to see t…

The UI is often a good way to quick get things done. Terraform requires a bit more investment, but has a huge payoff in the long run.

Personally, I think staging/production is the greatest advantage. I can experiment and break things on staging, then when I apply the plan to production I can be confident I’m getting the same infrastructure.

Infrastructure-as-code brings many programming amenities. You can write comments. You can easily see what a resource depends on and you can grep the repository to see what depends on it. You can version control it, which gives you a record of who changed what and possibly why. You can do code reviews.

It does take more time then clicking through a UI, but I can’t imagine operating all but the smallest infrastructure without Terraform or similar.

Re: Terraform 0.12

#75
I’ve been very excited for this release. I’m a huge fan of Terraform—When I first started using it I quickly couldn’t imagine working without it, despite its many rough edges. But it continues to improve (I can think of very few projects that have had such large and consistent improvement) and this release is another huge step forward. Props to Hashicorp for the great work.

Re: Terraform 0.12

#76

Earlier quoted context omitted.

Fair criticism, I've never used it, just what I've picked up from their marketing material.

> 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.

Personal 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

Re: Terraform 0.12

#77
post #34
post #14

Earlier quoted context omitted.

You can't write a local module for the resource that takes the differences as inputs?

Maybe I can, but I am failing to grasp how templates or the modules work, we have these resources where only the ami is different (and sometimes the count): resource "aws_instance" "nomadclients_tick" { ami = "${data.aws_ami.nomadclient_tick.image_id}" instance_type = "t2.micro" count = 3 iam_instance_profile = "${aws_iam_instance_profile.consul-join.name}" subnet_id = "${element(aws_subnet.consul.*.id, count.index)}…

I personally would solve this issue with a local module (very easy to set up, just a subfolder with a main.tf that defines the resources[0] then it's called as here[1]) with two input variables[2]: a required ami variable, and an optional count variable which has a default of 3. I hope that helps.

[0] https://www.terraform.io/docs/modules/index.html

[1] https://www.terraform.io/docs/modules/sources.html#local-pat...

[2] https://www.terraform.io/docs/configuration/variables.html

Re: Terraform 0.12

#78
post #49

Earlier quoted context omitted.

Viewing Terraform solely through the lens of cloud automation and in comparison with CloudFormation is a shortsighted mistake. Terraform has providers for plenty of other services that don't qualify as "cloud things" and lack proper configuration of their own. In a very general sense, Terraform is a terrific resource management tool with state versioning & locking built in. For example, there's a terraform-kafka-prov…

Someday folks will rediscover the potential of Puppet for these use cases. Until then, I'm content to watch countless alternative implementations come and go.

You are implying that people who use Terraform are not aware of Puppet. Puppet is a terribly complicated thing compare to Terraform. We use both on a daily basis and everybody agrees that we need to move away from Puppet. Terraform + Ansible is the way for us to go.

Re: Terraform 0.12

#80
post #34

Earlier quoted context omitted.

Maybe I can, but I am failing to grasp how templates or the modules work, we have these resources where only the ami is different (and sometimes the count): resource "aws_instance" "nomadclients_tick" { ami = "${data.aws_ami.nomadclient_tick.image_id}" instance_type = "t2.micro" count = 3 iam_instance_profile = "${aws_iam_instance_profile.consul-join.name}" subnet_id = "${element(aws_subnet.consul.*.id, count.index)}…

One way I can think of that will solve this problem is to do something like: resource "aws_instance" "nomadclients" { ami = "${count.index > 2 ? data.aws_ami.nomadclient_tick.image_id : data.aws_ami.nomadclient_tock.image_id}" instance_type = "t2.micro" count = 6 iam_instance_profile = "${aws_iam_instance_profile.consul-join.name}" subnet_id = "${element(aws_subnet.consul.*.id, count.index)}" vpc_security_group_ids =…

Alternatively you could put the AMIs in an array, and just iterate over that array.

  locals {
    nomad_ami = [
      "${data.aws_ami.nomadclient_tick.image_id}",
      "${data.aws_ami.nomadclient_tock.image_id}",
    ]
  }

  resource "aws_instance" "nomadclients" {
    count = 6
    ami   = "${element(local.nomad_ami, count.index)}"
  
    ...
  }
Post reply on HN