In this recipe, we will study a typical use case of Terraform in Azure in which we will provision and configure a VM in Azure using Terraform.
Getting ready
For this recipe, we don't need any special prerequisites. We will start the Terraform configuration from scratch. This recipe will only involve writing the Terraform configuration. In its stages of realization, we will study the writing of this code. As for the architecture in Azure, we have already built a network beforehand, which will contain this VM and which is made up of the following resources:
- A virtual network (VNet) called VNET-DEMO.
- Inside this VNet, a Subnet named Subnet1 is registered.
In addition, the VM that will be provisioned will have a public IP address so that it can be accessed publicly.
Finally, in keeping the VM's password secret in the code, we protect it in an Azure Key Vault, as studied in the Using Azure Key Vault with Terraform to protect...