Terraform Cookbook

Terraform Cookbook

Creating an Ansible inventory with Terraform

Terraform is a very good Infrastructure-as-Code (IaC) tool that allows us to build complex infrastructure with code.

As we studied in Chapter 6, Provisioning Azure Infrastructure with Terraform, concerning the construction of virtual machines, on all cloud providers, the common objective of Terraform is to build a VM without configuring it, which includes the installation of its middleware and its administration.

Among the Configuration-as-Code (CaC) tools that allow us to use Terraform to configure a VM after its creation, there is Ansible (https://www.ansible.com/), which is very popular in the open source world (much like Chef and Puppet).

One of the advantages of Ansible is that it's agentless, which means you don't need to install an agent on the VMs you want to configure. Thus, to know which VMs to configure, Ansible uses a file called inventory, which contains the list of VMs that need configuring.

In this recipe, we will learn...

Unlock full access

Continue reading with a subscription

Packt gives you instant online access to a library of over 7,500 practical eBooks and videos, constantly updated with the latest in tech

End of Section 3

Your notes and bookmarks