Repository for Terraform Infrastructure Deployment of Virtual Machines in Azure
Terraform Azure Virtual Machine Deployment This project utilizes Terraform to deploy virtual machines in Azure. The solution consists of several key files that work together to automate the deployment process.
#Solution Overview
-
main.tf The main.tf file contains the main Terraform configuration code. It defines the Azure resources to be provisioned, including virtual machines, networks, and other necessary components. In this file, you'll find resource definitions, such as azurerm_virtual_machine, azurerm_network_interface, and azurerm_resource_group.
-
variables.tf The variables.tf file defines input variables used in the Terraform configuration. These variables allow for customization and flexibility in the deployment process. Key variables include:
vm_count: Specifies the number of virtual machines to create. It's of type number and allows you to control the scale of your infrastructure by adjusting the count of virtual machines.
vm_flavor: Represents the type or configuration of the virtual machines to be created. It's of type string and allows you to specify the desired characteristics or size of the virtual machines, such as CPU, memory, and disk specifications.
admin_username: Defines the admin username for the virtual machines. It's of type string and provides the default value "myadminuser" for convenience, which you can change as needed. This username is typically used for administrative access to the virtual machines.
- terraform.tfvars The terraform.tfvars file contains the actual values for the input variables defined in variables.tf. Users provide values for these variables to customize the deployment according to their requirements. Example values include:
vm_count = 2 admin_username = "myadminuser"
In the image below are the resources created in Azure after running terraform apply
.
- output.tf The output.tf file defines the output values to be displayed after the Terraform apply operation. This may include important information such as IP addresses of the provisioned virtual machines. An example output definition is:
output "ping_results" { value = azurerm_virtual_machine.renta_vm.*.private_ip_address }
Next.. to test the provisioning script to verify the communication between the virtual machines.