Infrastructure as Code Terraform Configuration management
10/20/2022
Since DevOps practice is designed to improve the quality and speed of the entire SDLC process, there are many tools to work with each stage of it (or if not, we always have bash:).
In this article, we will talk about one of the most popular tools in the direction of Infrastructure as Code (IaC), namely - Terraform.
Infrastructure as code (IaC) is an approach to automating infrastructure deployment and changes by defining the desired state of resources and their relationships in code.
In other words, suppose we need to prepare a simple (or not) infrastructure for deploying a web application with a network, a database, the appropriate instance type, and other configurations of all the listed elements. Of course, all this can be done through the web console of the cloud provider you decide to work with (by the way, the list of such providers is described here, or you can even write your own provider), but during development, such an environment often needs to be changed, reproduced and duplicated for different environments. Therefore, it is not suitable to do it manually, as it is long, tedious, expensive, and also carries with it a high level of errors.
So, IaC avoids manual configuration and enforces consistency by well-documented code representing the desired environment state. Terraform uses its own "hcl" syntax for this.
You could use the needed flow depending on your system from the HashiCorp docs
(https://learn.hashicorp.com/tutorials/terraform/install-cli).
After writing the configuration you want to deploy, use the basic commands below.
Main commands: