welcome back, join me once again on our amazing terraform journey.
Terraform is informed by this block:
"What versions and providers are required for this project?"
Consider it similar to setting up the right equipment before beginning work.
Creating terraform configuration/main.tf

.
An Azure virtual network that serves as the primary private network for the operation of resources such as virtual machines.
A subnet within the virtual network. This subnet is where the virtual machine will be located.
A Network Security Group (NSG) that functions as a firewall, limiting the types of traffic that can enter and exit the virtual machine.
Before installing a virtual machine in Azure using Terraform, these blocks build the necessary network architecture (VNet → Subnet → Security Group).
Creating virtual network, subnet and Security group blocks for terraform Vm deployment

.
connects the subnet to the Network Security Group (NSG) so that all resources within the subnet are subject to the firewall rules.
establishes a Network Interface (NIC) to link the virtual machine to the network or subnet.
Associate security group with subnet and create Network interface

.
The Linux virtual machine in Azure is defined and created using azurerm_linux_virtual_machine.
network_interface: Enables communication between the virtual machine (VM) and the internet and other resources by connecting it to the Azure network.
admin_ssh_key: Provides a secure SSH key that can be used in place of a password to access the Linux virtual machine.
os_disk: Indicates the operating system disk settings for the virtual machine, including caching and storage type.
source_image_reference: Describes the operating system image that was used to generate the virtual machine (VM), such as Ubuntu or another Linux distribution.
Creating the virtual Machine with 5 properties
.
Using the specified.tf files, terraform apply creates or modifies infrastructure resources (such virtual machines, networks, or security groups) in the cloud provider.
Run terraform apply
In accordance with the Terraform configuration, Terraform adds, modifies, or removes infrastructure resources (such networks, virtual machines, or security groups) when you input yes after running Terraform apply.
Actions to be performed by terraform if you click yes
.




Top comments (0)