Skip to content

Commit

Permalink
Add new variable address_spaces (#61)
Browse files Browse the repository at this point in the history
* 0.13

* update

* update

* update

* update

* update

* update

* update
  • Loading branch information
yupwei68 authored May 24, 2021
1 parent acc4baf commit 176721b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "azurerm_resource_group" "example" {
module "network" {
source = "Azure/network/azurerm"
resource_group_name = azurerm_resource_group.example.name
address_space = "10.0.0.0/16"
address_spaces = ["10.0.0.0/16", "10.2.0.0/16"]
subnet_prefixes = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
subnet_names = ["subnet1", "subnet2", "subnet3"]
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "azurerm_virtual_network" "vnet" {
name = var.vnet_name
resource_group_name = data.azurerm_resource_group.network.name
location = data.azurerm_resource_group.network.location
address_space = [var.address_space]
address_space = length(var.address_spaces) == 0 ? [var.address_space] : var.address_spaces
dns_servers = var.dns_servers
tags = var.tags
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource "azurerm_resource_group" "test" {
module "network" {
source = "../../"
resource_group_name = azurerm_resource_group.test.name
address_space = "10.0.0.0/16"
address_spaces = ["10.0.0.0/16", "10.2.0.0/16"]
subnet_prefixes = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
subnet_names = ["subnet1", "subnet2", "subnet3"]

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ variable "address_space" {
default = "10.0.0.0/16"
}

variable "address_spaces" {
description = "The list of the address spaces that is used by the virtual network."
type = list(string)
default = []
}

# If no values specified, this defaults to Azure DNS
variable "dns_servers" {
description = "The DNS servers to be used with vNet."
Expand Down

0 comments on commit 176721b

Please sign in to comment.