Phase1-1
This commit is contained in:
@@ -8,5 +8,20 @@ terraform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provider "azurerm" {
|
provider "azurerm" {
|
||||||
# Configuration options
|
features{}
|
||||||
}
|
subscription_id = "4b2d6154-f4c5-4854-be82-12dfc82d4d23"
|
||||||
|
}
|
||||||
|
|
||||||
|
module "network" {
|
||||||
|
source = "../../modules/network"
|
||||||
|
vnet_name = "dev-vnet"
|
||||||
|
resource_group_name = "dev-rg"
|
||||||
|
location = "UK South"
|
||||||
|
address_space = ["10.0.0.0/16"]
|
||||||
|
subnets = { public = "10.0.1.0/24", private = "10.0.2.0/24" }
|
||||||
|
environment = "dev"
|
||||||
|
project = "TerraformBootcamp"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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" {
|
variable "resource_group_name" {
|
||||||
description = "Name of the resource group"
|
description = "Resource Group to create resources in"
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,11 +14,23 @@ variable "location" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "address_space" {
|
variable "address_space" {
|
||||||
description = "CIDR for the Virtual Network"
|
description = "CIDR blocks for the VNet"
|
||||||
type = list(string)
|
type = list(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "subnets" {
|
variable "subnets" {
|
||||||
description = "Map of subnet names and CIDRs"
|
description = "Map of subnet names to CIDR blocks"
|
||||||
type = map(string)
|
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