The short answer? Yes. For that matter, any programmer, new or old, can benefit from Terraform. I’m only a few months into my journey with Terraform and its already proving itself as extremely beneficial.
Before describing how Terraform can benefit you, it would probably be best to explain what Terraform is and get everyone on the same page. Terraform is software created by our partner Hashicorp, responsible for helping us to implement infrastructure as code. With the industry’s bid to turn everything into code, it seemed only natural for Hashicorp to provide a solution to spinning up service providers, whilst enabling easy versioning and replication. In a single sentence: Terraform allows us to turn the entire process of setting up cloud providers into code that can be automated and version controlled.
The main benefits of using Terraform are how replicable everything becomes and how easy it is to make changes and track said changes. Like any good code, all these resources that Terraform creates are easily transferrable.
Imagine, for some internal testing you set up a group of resources to test a Continuous Pipeline on AWS. The plan is to use an orchestration tool like Jenkins, test software like SonarQube and a binary repository like Nexus. You set up the resources, the security groups, subnet, etc. You configure the ports the software is expected to run on, along with various other requirements they need, like Java versions.
Four months later after the testing is complete, you need to set up the same solution for a client. Maybe with a different binary repository like JFrog. Only, the resources are gone. No reason to keep resources you weren’t using for four months (or if you did, that was four months of subscription for resources that weren’t being used- a loss either way). Now you have to go through the entire process of setting up everything again. In the best-case scenario with perfect documentation, you’d still have to manually go through each and every step, provisioning each resource and configuring each software package. More than likely, you’ll find a knowledge gap somewhere and you have to fumble around trying to get it all working again.
In addition to this, there are minor changes and updates. For example, a new port needs to be opened and perhaps the keys need changing for security reasons. Perhaps a value was misnamed and needs correction. How can you ensure that the changes won’t impact the setup of the service? Then for every change and update the documentation would also need updating as well to record this.
Terraform to the Rescue
With Terraform, most, if not all of the hassle, can be removed from that messy situation. Code can be reused infinitely, with perhaps some minor changes and updates to suit the new scenario.
Want to pre-install software like Jenkins and Nexus without having to manually download them and their dependencies? Turn it into a script and automate it.
Need to configure ports and environmental variables for said software? Put those in the script too.
A year has passed, maybe the original programmer for the solution has been moved to another project. Don’t worry, the terraform script remains.
Made a change to security groups and unsure if it works? Copy the code, make the change and run the code to verify its functionality. With some refactoring, it even becomes possible to only copy parts relevant to you. As with the scenario above, simply remove the script and associated config files, if any, for installing Nexus and prepare one for JFrog. Now you have a terraform code for installing a CI pipeline that supports either Nexus or JFrog, which can also be easily modified to work on other OSes and even install other tools.
Not For Everyone
Now that being said, an absolute newcomer, should not start using Terraform immediately. Terraform knowledge in no way supersedes the knowledge of the actual provider. Knowing that a security group exists and is needed for Terraform to create an AWS resource instance is not a suitable replacement for understanding WHY the security group is necessary or WHAT the security group does. Some hands on with what goes on “under the hood” still goes a long way.
My Short Terraform Journey So Far…
As infrastructure as code, Terraform provides an easily mutable code that is version controlled when integrated with other services like Git… And being code, it is easily repurposed for other projects and uses. As a new hire at ECS Digital with only a few months of using Terraform, I’ve already benefited tremendously from this incredible tool. Ranging from repurposing the code and scripts of others in my own setup, to easily providing fresh instances for me to test without all the manual work that goes into setting them up.
Just as excitingly, Hashicorp is far from done with Terraform. As of this article, Terraform is still at version 0.11. This means that there is still vast room for iteration and improvement on Terraform, such as better importing of pre-existing resources into Terraform’s set of managed resources.
Having already benefited so much from Terraform in its early life cycle, I am certainly keen to see what more can be done with it. If you’re interested in starting your Terraform journey with us, feel free to contact us or check out our Hashicorp training we provided as official Hashicorp partners.