We are currently experiencing a technological evolution that moves at the speed of light, where people are more open to change and improvements and revolutionary ideas come along with new paradigms that give birth to incredible new technologies and products.
When it comes to software, the evolution is visible. Software applications are the central point of this evolution and must be continuously improved in order to help mitigate new challenges.
When we talk about software applications we can find many useful traits: we can persist all the changes we make and translate them with programming languages in order to create our applications. This allows us to have a programmable and traceable piece of code that we can reuse anywhere and apply it with the exact same configurations. This code, if made human readable, can also serve as documentation.
Sometimes, the infrastructure that supports the revolutionary applications must evolve as well. Infrastructure is a very abstract concept, but it can generally be defined as the entire physical or logical resources needed to support the applicational solutions on top of it. The traditional process of providing infrastructure is slow and untraceable by default. It is mainly done manually and the process to replicate environments is repetitive. Furthermore, documentation and guidelines are very important in this kind of provisioning in order to transfer knowledge among developers and to maintain the scripting process. Unfortunately, this is often forgotten.
When it comes to infrastructure evolution, the new paradigm of cloud computing is the most significant change. We can now pay for services instead of having to build all the infrastructure from the bare metal and rely on providers to manage some difficult and painful processes for us. Prices can be very attractive and in most cases they can be lower than the typical ones.
There is a tremendous increase of versatility in the cloud and we can manage most of the resources without leaving a web browser console, often times enhanced with great visuals and a user-friendly experience. But what if we want use infrastructure like we use applicational code? Could we persist infrastructure code and version it? And have logic as if it’s a programming language?
Well… Now we can! Besides cloud, this was one of the most remarkable evolutions of infrastructure. Combining cloud providers with Terraform we can have all the perks of the applicational software development on infrastructure itself. Terraform is a tool created by Hashicorp that provides us with a way to manage infrastructure as code and the process is very identical to any other code. Write code into files, run the Terraform binary against those files, and in a couple of minutes we have the infrastructure up and running. As this is code, it makes versioning a possibility.
Terraform interprets the code that we have written and creates a state file. That state file is where the current known state of the infrastructure is stored. Every time we make a change in the infrastructure code, Terraform finds the differences between the last known state and the configuration files that are going to be applied. Next, it describes all the changes and if we accept them, it will provision the new features and update the state file for the new version in a matter of minutes.
As we work with persisted code, we can set an automation process to help save time. Imagine for instance an automated pipeline separated by stages such as the following ones:
1 - Develop the infrastructure code and push to a version control repository, so that the code is stored and versioned.
2 - Test infrastructure code against syntax errors and code smells.
3 - Provision the infrastructure on a validation workspace in order to test infrastructure for security vulnerabilities before going to a production-like environment.
4- If everything goes well, provision the infrastructure on the target environment.
“IT infrastructure embraces change, rather than being an obstacle or a constraint” – Kief Morris
This is only the tip of the iceberg in terms of automation. IaC can provide an infrastructure much faster than a conventional approach and because we are using code, there are many continuous integration strategies that can be applied. If all of this was completely automatic, it would allow developers to have more time to develop and not waste time with repetitive tasks.
Automation is key. Indeed, automation powers the world.
More information to explore: