Building Infrastructure with Terraform

Terraform is similar to Amazon Cloud Formation. It allows you to automate the creation of your infrastructure like VPCs, ELBS, ASGs, Instances. Terraform is generic, it works with other provides besides AWS like containers and even bare-metal servers. Terraform build infrastructure, but also launch it as well.

Terraform enables infrastructure as a Code because you can describe your whole infrastructure with a simple set of declarative files. Terraform keeps track of state, so will tell you if can do something or can't do some operation. This is very cool for operation point of view. To use Terraform you just need to download the binaries for your OS and them put Terraform in your PATH. Once you have the config files you can do $ terraform apply and the magic will happen :-)

Today i will show how to build a very simple infrastructure on AWS, you just need have your credential(ID and Secret).  Main.tf is your config for the infrastructure. Variables are var you can use into your main and outputs is what terraform will output for you when its done. Download all this 3 scripts put into terraform folder, drop you pem file as well and just run $ terraform apply.
main.tf


outputs.tf

variables.tf

Cheers,
Diego Pacheco

Popular posts from this blog

Kafka Streams with Java 15

Rust and Java Interoperability

HMAC in Java