2 ms·
VIP: Very Important Tip +++ Use jetbrains free IDE (IntelliJ, PyCharm...) and install the plugins for HCL support. You'll get syntax highlighting + auto compl
by user5994461 10y ago
VIP: Very Important Tip
+++ Use jetbrains free IDE (IntelliJ, PyCharm...) and install the plugins for HCL support.
You'll get syntax highlighting + auto completion for variable and infrastructure names + visual report on lines with errors and quickfixes.
Now HCL just because the easiest language in the world. (Seriously, it's not even a language, it takes 1 hour to master the syntax, top.)
+++ Use terraform to create all the infrastructure backbone. (VPC, subnets, routing tables, DHCP options, etc... )
Terraform is the single best tool in the world to do that. It's also the only one currently in existence that is actually able to do that. (ansible and the likes are missing critical modules).
+++ Do NOT use terraform to manage instances nor security groups.
These things change wayyy too often and you'll struggle with states.
Use one of the ansible/salt to create and manage them. They refresh their inventory to keep with external changes (at least ansible does) and they allow to run scripts on the resources. (e.g. tag all the EBS volumes of the instance, after the instance is up).
Bonus: For every instance "name" you create, create and put it in a security group with the same "name". Then you can manage security groups by name ;)
+++ Terraform can import existing infrastructure since v0.7 (this release :D)
Just sayin'.
+++ The state files is annoying to share and keep updated
It used to be put in git. (it's still possible).
It can be put in S3 (or similar options). The sharing is faster and it makes less state issues.
+++ Because of the state files, terraform is good for "static things" and terrible for "fast moving things".
That makes terraform appropriate for the VPC/subnet/... provisioning (the first point in this list )
But it's terrible for instances and security groups (another point in the list )
Known your strengths and weaknesses, choose the right tool for the job ;)