Phase1-1
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
resource "azurerm_virtual_network" "main" {
|
||||
name = var.vnet_name
|
||||
resource_group_name = var.resource_group_name
|
||||
location = var.location
|
||||
address_space = var.address_space
|
||||
}
|
||||
|
||||
resource "azurerm_subnet" "subnets" {
|
||||
for_each = var.subnets
|
||||
name = each.key
|
||||
resource_group_name = var.resource_group_name
|
||||
virtual_network_name = azurerm_virtual_network.main.name
|
||||
address_prefixes = [each.value]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
variable "vnet_name" {
|
||||
description = "Name of the Virtual Network"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "resource_group_name" {
|
||||
description = "Name of the resource group"
|
||||
description = "Resource Group to create resources in"
|
||||
type = string
|
||||
}
|
||||
|
||||
@@ -9,11 +14,23 @@ variable "location" {
|
||||
}
|
||||
|
||||
variable "address_space" {
|
||||
description = "CIDR for the Virtual Network"
|
||||
description = "CIDR blocks for the VNet"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "subnets" {
|
||||
description = "Map of subnet names and CIDRs"
|
||||
description = "Map of subnet names to CIDR blocks"
|
||||
type = map(string)
|
||||
}
|
||||
}
|
||||
|
||||
variable "environment" {
|
||||
description = "Environment tag (dev/prod)"
|
||||
type = string
|
||||
default = "dev"
|
||||
}
|
||||
|
||||
variable "project" {
|
||||
description = "Project tag"
|
||||
type = string
|
||||
default = "TerraformBootcamp"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user