Using Ansible as a provisioning tool in Terraform
Ansible can be used as an IaC tool, as you learned in Chapter 7, Managing Your Virtualization and Cloud Platforms. At the same time, it is a common practice in the industry to use the right tool for the right task – for example, Terraform for IaC, Ansible for IT automation, Jenkins for CI/CD pipelines, and so on. Instead of comparing similar tools, integrate them in the right place and achieve better results.
Terraform is an open source tool by HashiCorp for implementing IaC practices. Terraform can be used to deploy and manage the cloud-based infrastructure and applications using infrastructure code written in a declarative configuration language called HashiCorp Configuration Language (HCL). Depending on the cloud platform and components, use the provider modules and resources available. Refer to https://registry.terraform.io/browse/providers to explore the available and supported providers.
For example, the following...