Creating a Terraform module and using it locally
A Terraform module is a Terraform configuration that contains one or more Terraform resources.
Once created, this module can be used in several Terraform configuration files either locally or even remotely.
In this recipe, we will look at the steps involved in creating a module and using it locally.
Getting ready
To start this recipe, we will use the Terraform configuration that we already wrote in the Provisioning infrastructure in multiple environments recipe of Chapter 3, Scaling Your Infrastructure with Terraform, and whose sources can be found at https://github.com/PacktPublishing/Terraform-Cookbook-Second-Edition/tree/main/CHAP07/sample-app.
The module we will create in this recipe will be in charge of providing an Azure Service Plan, one App Service, and an Application Insights resource in Azure. Its source code is available here: https://github.com/PacktPublishing/Terraform-Cookbook-Second-Edition/tree/main...