Terraform 0.12
31–40 of 167 posts
Re: Terraform 0.12
#32I moved away from Terraform a long time ago. Ansible was way more powerful, handled errors and issues with state changes. Terraform was super picky about how you had to operate, slow and HCL was a terrible markup language. I wasn't really a huge fan of Ansible either though and more recently have been doing things in regular shell/Bash scripts. Now with Kubernetes and service brokers, there is no need for Terraform.
What about setting up and tearing down EKS clusters? I haven't used terraform but I learned about it through looking at this: https://learn.hashicorp.com/terraform/aws/eks-intro So, I'd say Kubernetes itself does more heavy lifting but not all of it?
https://github.com/JasonCarter80/contoso_aws_k8s/tree/master...
Re: Terraform 0.12
#33Re: Terraform 0.12
#34Earlier quoted context omitted.
The biggest issue we have with Terraform (and other Hashicorp tools in general, really) is their different configuration formats, but mostly it is HCL limitations. I haven't found a solution for it, but I have lots of resources that are almost identical, except for a few arguments, but right now it seems like my options are to either write my own Ruby script to output .hcl files, or live with two resources that are a…
You can't write a local module for the resource that takes the differences as inputs?
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)}"
vpc_security_group_ids = [
"${aws_security_group.rule01.id}",
"${aws_security_group.rule02.id}",
"${aws_security_group.rule03.id}",
"${aws_security_group.rule04.id}",
]
}
resource "aws_instance" "nomadclients_tock" {
ami = "${data.aws_ami.nomadclient_tock.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)}"
vpc_security_group_ids = [
"${aws_security_group.rule01.id}",
"${aws_security_group.rule02.id}",
"${aws_security_group.rule03.id}",
"${aws_security_group.rule04.id}",
]
}
The examples I have found feels very difficult.Re: Terraform 0.12
#35Earlier quoted context omitted.
As 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, repeatabl…
>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?
Re: Terraform 0.12
#36Earlier quoted context omitted.
IMO they should have dumped HCL once they caught a whiff of what Pulumi is up to, much rather go with actual languages that when you learn them, you pick up some valued knowledge. You can also do a whole lot more with Typescript than you can with HCL 2.
Agreed, the data model of Terraform simply doesn’t match the problem domain. You need an algorithm to codify the pattern and then data to fill in the params. Terraform doesn’t allow you to create the patterns you need in a way that’s debugable and doesn’t allow for code reuse. For simple setups it’s not apparent there’s a problem but when they get more complex it’s nearly impossible to use. Additionally you have to r…
Re: Terraform 0.12
#37I honestly love Terraform as a product. It was one of probably three tools I've used in my entire career that made me feel immediately more productive. After using it for a very short period of time I was shocked developers continued to struggle through CF templates and the fragility the whole process entailed.
Re: Terraform 0.12
#38I’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?
As 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, repeatabl…
Re: Terraform 0.12
#39Earlier 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)}…
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 = [
"${aws_security_group.rule01.id}",
"${aws_security_group.rule02.id}",
"${aws_security_group.rule03.id}",
"${aws_security_group.rule04.id}",
]
}
The downside to this approach (in TF Because of these headaches, we decided to abandon hcl for these use cases and ended up writing our own preprocessor that takes a JSON configuration and generates individual JSON-based HCL (ie. .json.tf) that terraform can then use. We can leverage proper templating to generate many variants of a single resource in a higher level language, while still using terraform to manage the infrastructure and it only adds one additional step to the plan + apply process.Re: Terraform 0.12
#40I honestly love Terraform as a product. It was one of probably three tools I've used in my entire career that made me feel immediately more productive. After using it for a very short period of time I was shocked developers continued to struggle through CF templates and the fragility the whole process entailed.
Agreed about CF. AWS puts a huge emphasis on CloudFormation when they know it is sub-par. Ansible is pretty cool too because you can easily convert between YAML/JSON for CF, and add a lot of flexibility based on variables and other things such as error handling that you can't do with Terraform.