This module creates the basic and advance network resources for a region.
| Name | Version |
|---|---|
| terraform | >= 1.3.0 |
Before you begin, ensure you have the following installed:
- Terraform (version X.XX.X)
- Azure CLI (version X.XX.X)
- Azure Subscription
Follow the steps below to get started with the project:
- Clone this repository to your local machine.
- Authenticate the Azure CLI with your Azure Subscription using
az login. - Initialize Terraform by running
terraform init. - If you want to create VNet with advanced subnet settings (enable natgateway , user defined security rule per subnet) etc.. then choose the vnet-advance module in example module.
The project uses the following variables:
location: The Azure region where resources will be created.resource_group_name: The name of the resource group where resources will be provisioned.vnet_name: The name of the Virtual Network.subnet_type: The type of subnets to create.subnet_bits: The number of simple subnets to create (used whensubnet_type = "subnet-simple").
To provision the resources, modify the variables in variables.tf to match your desired configuration. Then, run the following Terraform commands:
terraform init: Initializes the Terraform configuration.terraform plan: Shows the execution plan for the resources.terraform apply: Applies the changes and creates the Azure resources.
| Name | Source |
|---|---|
| nsg | ./modules/nsg |
| route_table | ./modules/route_table |
| subnets | .modules/subnets |
| vnet | ./modules/vnet |
| Name | Type |
|---|---|
| azurerm_virtual_network.main | resource |
| azurerm_network_security_group.main | resource |
| azurerm_route_table.main | resource |
| azurerm_subnet.subnets | resource |
| azurerm_resource_group.rg | resource |
| azurerm_subnet_route_table_association.main | resource |
| azurerm_subnet_network_security_group_association | resource |
| Name | Description | Type |
|---|---|---|
| subnet_type | define the type of the subnet for subnet_simple | string |
| address_space | specify the CIDR Block for vnet | string |
| subnet_bits | define the number of subnet_simple creates | number |
| resource_group_name | specify the name of the resource group | string |
| location | specify the location of the vnet | string |
| subnets | specify the subnets name having cidr_ranges and is_public variable etc.. | map(object({ |
Below are some useful Terraform commands for managing the project:
terraform init: Initializes the Terraform configuration.terraform validate: To validate the syntax of the configuration.terraform plan: Shows the execution plan for the resources.terraform apply: Applies the changes and creates the Azure resources.terraform destroy: Destroys all resources created by Terraform.
Module managed by TO THE NEW Pvt. Ltd.
Apache 2 Licensed. See LICENSE for full details.