Azurerm_Subnet
The azurerm_subnet
resource in Terraform is used to define and manage a subnet within an Azure Virtual Network (VNet). Subnets are logical subdivisions of a VNet, and they help you organize and segment your network resources. You can use the azurerm_subnet
resource to create, update, or delete subnets as part of your infrastructure as code (IAC) deployment in Azure using Terraform.
Here’s an example of how to define an azurerm_subnet
resource in a Terraform configuration:
resource "azurerm_subnet" "example" {
name = "mySubnet"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.1.0/24"]
}
In this example:
azurerm_subnet
is the resource type."example"
is the name given to this particular subnet resource, which you can use to reference it in other parts of your Terraform configuration.
The resource block specifies the following attributes:
name
: The name of the subnet.resource_group_name
: The name of the Azure resource group where the subnet will be created. It is assumed that you’ve already defined anazurerm_resource_group
resource elsewhere in your configuration.virtual_network_name
: The name of the Azure Virtual Network where the subnet will be created. You should also have defined anazurerm_virtual_network
resource earlier.address_prefixes
: The IP address range (CIDR block) for the subnet. This determines the range of IP addresses that can be assigned to resources within the subnet.
Azure Training Demo Day 1 Video
Conclusion:
Unogeeks is the No.1 IT Training Institute for Microsoft Azure Training. Anyone Disagree? Please drop in a comment
You can check out our other latest blogs on Microsoft Azure here – Microsoft Azure Blogs
You can check out our Best In Class Microsoft Azure Training Details here – Microsoft Azure Training
Follow & Connect with us:
———————————-
For Training inquiries:
Call/Whatsapp: +91 73960 33555
Mail us at: info@unogeeks.com
Our Website ➜ https://unogeeks.com
Follow us:
Instagram: https://www.instagram.com/unogeeks
Facebook:https://www.facebook.com/UnogeeksSoftwareTrainingInstitute
Twitter: https://twitter.com/unogeeks