One of the highlights my week was 10% time at work. This is the one day a fortnight which the team can dedicate to individual learning. Personal learning can focus on our personal development goals which are set each quarter, picking something off of the backlog board, or learn about something which could improve our abilities as developers.
Personally, I had spent the last few 10% sessions on my apprenticeship work, but now that has been boxed off. This would be the first week that I could focus on something else.
I chose Terraform. And I thought what better way to learn than to write about it?
So here is the first of my 10% summaries:
What is Terraform? According to Wikipedia, Terraform is an open-source infrastructure created by HashiCorp. It does this through an “infrastructure as code” approach.
To follow the “infrastructure as code”, developers can define the code’s infrastructure using JSON, YAML or HashiCorp Configuration Language.
You can spot a Terraform file based on the
.tf file extension. If a project contains multiple Terraform files then the compiler will merge these files upon running.
Developers can take advantage of the ability to create identical environments. By creating similar environments, means that the infrastructure is consistent and predictable.
Another benefit is that the environment is idempotent. Idempotent means that Terraform is aware of the infrastructure’s state, so if a request is made that matches the current state of the infrastructure, then nothing is done.
- What about the commands?
Ok next stop, what are some important commands you’ll need to know when you get started with Terraform?
terraform run this to see if your machine has Terraform installed. It will display the details of your installation.
terraform init here we are initialising the working directory which contains the Terraform file
terraform plan this command is used to create an execution plan
terraform destroy and as this one suggests, once you are finished you can run this command to destroy the infrastructure. If you are running this in AWS then running Terraform infrastructures have a charge (which varies depending on the size of the infrastructure). If you’re no longer using it then destroying it will save those costs.
It was interesting as I’m still new to learning about AWS and I know there is still plenty to learn. My next step will be to start working on real life code.
If you would be interested in a step by step guide when I learn it let me know in the comments!