Live data from Hacker News

Terraform 1.0

github.com

31–40 of 315 posts

Re: Terraform 1.0

#31
post #9

I hate Terraform with a passion but it is probably the best tool out there for managing cloud infrastructure so I use it at work with no plans to replace it. The biggest downsides are the awful half-baked language and the awkwardness of modules and passing values throughout your config. Also the staticness of providers are a serious pain, for example you can't create a kubernetes cluster then add a resource to it. Th…

I strongly agree both with respect for the half-baked-ness of the language and with the "it's probably the best out there". Ultimately, these tools should have a static/yaml-like "assembly language" that describes the state of your infrastructure without any of the DRY. There would be a diffing engine which would figure out what changes need to be applied and apply them accordingly. Users could use some vanilla programming language to generate that yaml in a DRY way; then the Terraform folks don't need to badly reinvent a programming language.

I know they also have a CDK, but I can't tell if it properly solves that problem or if it still forces us into Terraform idiosyncrasies (i.e., if I rename something in Terraform, it will try to delete the corresponding resource and recreate it, and I think that absurd behavior remains with the CDK).

Re: Terraform 1.0

#32

Earlier quoted context omitted.

Amen! I found it excruciating that the language was always a few simple steps away from being homomorphic to JSON. I desperately needed to be able to manipulate it as data structures, not as strings. All of the ways I found to work around its limitations made me wish for something else entirely.

You can write Terraform using JSON if you want to: https://www.terraform.io/docs/language/syntax/json.html Or do you mean something deeper?

I mean being able to reliably convert HCL↔JSON.

Re: Terraform 1.0

#33

You people hating on Terraform are spoiled. My company insists on using CloudFormation, which I hate with a passion.

I've used both - with having to use CF to create a particularly gnarly and sprawling environment. I constantly ran into limitations hidden behind cryptic or unrelated error messages. It was infuriating.

Terraform syntax is definitely not sexy, but it's a robust piece of software, and in fact, can be used to learn better Go techniques.

A total aside, but people who claim Golang is easy are full of it. It's an extremely hard language to write well at scale, and Terraform is a good example to study.

Re: Terraform 1.0

#34

Earlier quoted context omitted.

Yes, however this will work (typically) if the cluster already exists (a previous run), but typically not if you creating the cluster, and kubernetes provider, as part of the same run. IIRC you'll end up with a kubernetes provider without auth (typically pointing at your local machine), which is 1, not helpful, and 2) can be actively bad. I believe the core issue here is that providers don't have the ability to speci…

This works even without the depends_on property. All you need to is have the module you use for creating the cluster have an output that is guaranteed to be a computed property. Then use that computed property as input variable for whatever you want to deploy into Kubernetes. We're using this with multiple providers and it works. Of course, an actual dependency that's visible would be better.

I'd love to see an example of this actually working, because I have had the opposite experience (explicitly with the Kubernetes and Helm providers); I've had to do applies in multiple steps.

Re: Terraform 1.0

#35

You people hating on Terraform are spoiled. My company insists on using CloudFormation, which I hate with a passion.

your company sounds like they know what they are doing. Cloudformation will take your infrastructure from point A to point B or roll it back in case of failure. Terraform, not so much.

Re: Terraform 1.0

#36
post #25
post #9

I hate Terraform with a passion but it is probably the best tool out there for managing cloud infrastructure so I use it at work with no plans to replace it. The biggest downsides are the awful half-baked language and the awkwardness of modules and passing values throughout your config. Also the staticness of providers are a serious pain, for example you can't create a kubernetes cluster then add a resource to it. Th…

People mention pulumi but hashicorp are creating something similar with https://github.com/hashicorp/terraform-cdk . But all the existing terraform providers work with it afaik.

I don't know if people have even tried Pulumi before recommending it.

I've tried it, and it has buggy defaults, diff generation, etc. Each time I applied the same code, it would generate a diff based off of some internal defaults and... recreate the exact same infrastructure by _tearing it down_ and making it fresh. Not ideal.

Would advise using the TF CDK specifically.

Re: Terraform 1.0

#37
Serious question. What value does Terraform provide?

Two years ago I looked into it and rather then having an abstraction from cloud providers it seemed to require to still target (and code against) each one specifically.

So, I was quite disappointed as I thought the value proposition was to not have to know x cloud provider specific terminologies.

Any insights much appreciated.

Edit: I was a little worried asking such a naive question but the comments are super useful! Thanks everyone for sharing your insights.

Re: Terraform 1.0

#38
There is a dupe Terraform post on Hacker news frontpage. I'll post my comment here too :-)

I recommend breaking out your terraform code into separate folders and calling them "components". Write a wrapper around the terraform script to pass in -var-file which uses an argument called ENVIRONMENT that you pass to the wrapper. I think the built in support for modules is less useful for what you actually want to do because you end up with variables spread between variables.tf, outputs.tf files. I use a tool I wrote to layer my infrastructure with layers called components and I configure it with a Graphviz file.

My tool, called mazzle (previously devops-pipeline) would run parts of the graph that can run in parallel in parallel. It can also run parts of the build on SSH workers. You bring up the workers at the beginning of the build.

Here's an example of a graph generated from graphviz file: https://github.com/samsquire/mazzle-starter/blob/master/arch...

This graph brings up a hashicorp vault server, Java application, bastion proxy, consul, kubernetes, prometheus

here's the graphviz file:

https://github.com/samsquire/mazzle/blob/master/docs/archite...

It describes the ordering of the infrastructure, the invocation of Ansible, packer, shell scripts to set up vault etc.

The idea is to be able to bring up a new environment by changing one parameter. There's a React GUI too.

https://devops-pipeline.com

Re: Terraform 1.0

#39
post #26
post #9

I hate Terraform with a passion but it is probably the best tool out there for managing cloud infrastructure so I use it at work with no plans to replace it. The biggest downsides are the awful half-baked language and the awkwardness of modules and passing values throughout your config. Also the staticness of providers are a serious pain, for example you can't create a kubernetes cluster then add a resource to it. Th…

I like Terraform for infrastructure, up to the point of creating the K8s cluster, then ArgoCD for keeping K8s in sync.

That's an interesting combo. What are you keeping in sync in K8s with Argo?

Re: Terraform 1.0

#40
post #36
post #25

Earlier quoted context omitted.

People mention pulumi but hashicorp are creating something similar with https://github.com/hashicorp/terraform-cdk . But all the existing terraform providers work with it afaik.

I don't know if people have even tried Pulumi before recommending it. I've tried it, and it has buggy defaults, diff generation, etc. Each time I applied the same code, it would generate a diff based off of some internal defaults and... recreate the exact same infrastructure by _tearing it down_ and making it fresh. Not ideal. Would advise using the TF CDK specifically.

The token system is broken in TF CDK still and it's not ready for adoption. I've built two stacks with it but I'm back at terraform for now. I intend to explore pulumi though when the opportunity presents itself.

I think using a Turing-complete language like typescript with mature tooling to define cloud infrastructure feels very natural and makes things much more manageable than using HCL.

One thing I absolutely can't do without is the state management api terraform provides with its CLI. This is absent from terraform-cdk and aws's CDK, although many of the same APIs seem to exist for pulumi.

Post reply on HN