In the previous post we discussed about IaC. In this post, lets discuss more about what are the different IaC Approaches and tools.
When dealing with IaC, There are two major approaches for writing code, which are Imperative approach and Declarative approach. Let us learn about these approaches in more detail and understand the difference between the two.
1. An imperative approach (Procedural)
It defines the specific commands needed to achieve the desired configuration, and those commands then need to be executed in the correct order. Basically, it deals with 'the how,' i.e., how we reached our desired configuration. Lets understand it better with the help of below example.
![](https://static.wixstatic.com/media/202b75_5b56a79c3f124053afac766eb1a21a84~mv2.png/v1/fill/w_980,h_107,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/202b75_5b56a79c3f124053afac766eb1a21a84~mv2.png)
2. A declarative approach (Functional)
A declarative approach defines the desired state of the system, including what resources you need and any properties they should have, and an IaC tool will configure it for you. It deals with 'the what,' i.e., what is the desired state for the configuration.
![](https://static.wixstatic.com/media/202b75_cbdbfe52f1974a2aae0a8d689c49374d~mv2.png/v1/fill/w_218,h_165,al_c,q_85,enc_auto/202b75_cbdbfe52f1974a2aae0a8d689c49374d~mv2.png)
Many IaC tools use a declarative approach as it offers a greater degree of flexibility and will automatically provision the desired infrastructure. If you make changes to the desired state, a declarative IaC tool will apply those changes for you. An imperative tool will require you to figure out how those changes should be applied.
How Infrastructure as Code Works?
Infrastructure as Code can be explained from a high level in three simple steps and visualized with the diagram below.
![](https://static.wixstatic.com/media/202b75_ea219bbfb89b45f4a919c9f690f66bf3~mv2.png/v1/fill/w_798,h_526,al_c,q_90,enc_auto/202b75_ea219bbfb89b45f4a919c9f690f66bf3~mv2.png)
Developers write the infrastructure specification in a domain-specific language.
The resulting files are sent to a master server, a management API, or a code repository.
The platform takes all the necessary steps to create and configure the computer resources.
IaC Tools -
There are many tools that fulfill infrastructure automation capabilities and use IaC. I've listed some of them as below -
![](https://static.wixstatic.com/media/202b75_7f8d316fc3a14c488331370ed6fd6154~mv2.png/v1/fill/w_843,h_174,al_c,q_85,enc_auto/202b75_7f8d316fc3a14c488331370ed6fd6154~mv2.png)
Other tools include Pulumi, AWS CloudFormation, cdist, StackStorm, Azure Resource Templates and Juju.
Automation of infrastructure is now a major requirement for every team in an organization. For this automation, many tools and methodologies are available. One tool will not be able to fulfill the requirements of the organization. Therefore, tools should be selected on the basis of the requirements of the organization and various other factors such as cost, skillset, functionality, and so on.
I hope you find this post informative.
Thank you for reading!
*** Explore | Share | Grow ***
Comentarios