diff --git a/_example/basic/example.tf b/_example/basic/example.tf index 305fbcf..0155406 100644 --- a/_example/basic/example.tf +++ b/_example/basic/example.tf @@ -14,8 +14,8 @@ module "vnet" { source = "../../" name = local.name environment = local.environment - resource_group_name = "testsg" + resource_group_name = "testrg" location = "NorthEurope" - address_space = "10.0.0.0/16" + address_spaces = ["10.0.0.0/16"] enable_network_watcher = false # To be set true when network security group flow logs are to be tracked and network watcher with specific name is to be deployed. -} +} \ No newline at end of file diff --git a/_example/basic/versions.tf b/_example/basic/versions.tf index f5b95bc..9ffba34 100644 --- a/_example/basic/versions.tf +++ b/_example/basic/versions.tf @@ -1,13 +1,13 @@ # Terraform version terraform { - required_version = ">= 1.6.5" + required_version = ">= 1.6.6" } terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">=3.83.0" + version = ">=3.85.0" } } } diff --git a/_example/complete/example.tf b/_example/complete/example.tf index 4426922..993eb49 100644 --- a/_example/complete/example.tf +++ b/_example/complete/example.tf @@ -28,7 +28,7 @@ module "vnet" { environment = local.environment resource_group_name = module.resource_group.resource_group_name location = module.resource_group.resource_group_location - address_space = "10.0.0.0/16" + address_spaces = ["10.0.0.0/16"] enable_ddos_pp = false enable_network_watcher = false # To be set true when network security group flow logs are to be tracked and network watcher with specific name is to be deployed. } diff --git a/_example/complete/versions.tf b/_example/complete/versions.tf index f5b95bc..9ffba34 100644 --- a/_example/complete/versions.tf +++ b/_example/complete/versions.tf @@ -1,13 +1,13 @@ # Terraform version terraform { - required_version = ">= 1.6.5" + required_version = ">= 1.6.6" } terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">=3.83.0" + version = ">=3.85.0" } } } diff --git a/_example/vnet_with_existing_ddos_id/example.tf b/_example/vnet_with_existing_ddos_id/example.tf index 6ac5d83..a8a53be 100644 --- a/_example/vnet_with_existing_ddos_id/example.tf +++ b/_example/vnet_with_existing_ddos_id/example.tf @@ -28,7 +28,7 @@ module "vnet" { environment = local.environment resource_group_name = module.resource_group.resource_group_name location = module.resource_group.resource_group_location - address_space = "10.0.0.0/16" - existing_ddos_pp = "/subscriptions/068245d4-3c94-42fe-9c4d-9e5e1cabc60c/resourceGroups/" + address_spaces = ["10.0.0.0/16"] + existing_ddos_pp = "/subscriptions/c/ddosProtectionPlans/vnetddos" enable_network_watcher = false # To be set true when network security group flow logs are to be tracked and network watcher with specific name is to be deployed. } diff --git a/_example/vnet_with_existing_ddos_id/versions.tf b/_example/vnet_with_existing_ddos_id/versions.tf index f5b95bc..9ffba34 100644 --- a/_example/vnet_with_existing_ddos_id/versions.tf +++ b/_example/vnet_with_existing_ddos_id/versions.tf @@ -1,13 +1,13 @@ # Terraform version terraform { - required_version = ">= 1.6.5" + required_version = ">= 1.6.6" } terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">=3.83.0" + version = ">=3.85.0" } } } diff --git a/main.tf b/main.tf index a52dbe8..a3aa108 100644 --- a/main.tf +++ b/main.tf @@ -24,7 +24,7 @@ module "labels" { resource "azurerm_virtual_network" "vnet" { count = var.enable == true ? 1 : 0 name = format("%s-vnet", module.labels.id) - address_space = length(var.address_spaces) == 0 ? [var.address_space] : var.address_spaces + address_space = var.address_spaces resource_group_name = var.resource_group_name flow_timeout_in_minutes = var.flow_timeout_in_minutes location = var.location @@ -36,15 +36,6 @@ resource "azurerm_virtual_network" "vnet" { enforcement = var.enforcement } - dynamic "subnet" { - for_each = var.subnets == null ? [] : var.subnets - content { - name = subnets.value.name - address_prefix = subnets.value.address_prefix - security_group = subnets.security_group - } - } - dynamic "ddos_protection_plan" { for_each = local.ddos_pp_id != null ? ["ddos_protection_plan"] : [] content { diff --git a/variables.tf b/variables.tf index 6698753..8c643f8 100644 --- a/variables.tf +++ b/variables.tf @@ -2,7 +2,7 @@ #Description : Terraform label module variables. variable "name" { type = string - default = "" + default = null description = "Name (e.g. `app` or `cluster`)." } @@ -20,7 +20,7 @@ variable "repository" { variable "environment" { type = string - default = "" + default = null description = "Environment (e.g. `prod`, `dev`, `staging`)." } @@ -44,22 +44,16 @@ variable "enable" { variable "resource_group_name" { type = string - default = "" + default = null description = "The name of the resource group in which to create the virtual network. Changing this forces a new resource to be created." } variable "location" { type = string - default = "" + default = null description = "The location/region where the virtual network is created. Changing this forces a new resource to be created." } -variable "address_space" { - type = string - default = "" - description = "The address space that is used by the virtual network." -} - variable "address_spaces" { type = list(string) default = [] @@ -112,12 +106,4 @@ variable "enforcement" { description = "Specifies if the encrypted Virtual Network allows VM that does not support encryption. Possible values are DropUnencrypted and AllowUnencrypted." } -variable "subnets" { - type = list(object({ - name = string - address_prefix = string - security_group = list(any) - })) - default = null - description = "Can be specified multiple times to define multiple subnets. Each subnet block supports fields documented below." -} + diff --git a/versions.tf b/versions.tf index f5b95bc..9ffba34 100644 --- a/versions.tf +++ b/versions.tf @@ -1,13 +1,13 @@ # Terraform version terraform { - required_version = ">= 1.6.5" + required_version = ">= 1.6.6" } terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">=3.83.0" + version = ">=3.85.0" } } }