Skip to content

Commit

Permalink
Make network config a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
simongottschlag committed Feb 28, 2023
1 parent 1aefb2a commit f7fdecb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions terraform-module/platform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ resource "azurerm_virtual_network" "this" {
name = "vnet-${local.eln}"
location = azurerm_resource_group.platform.location
resource_group_name = azurerm_resource_group.platform.name
address_space = ["10.0.0.0/16"]
address_space = [var.network.virtual_network_address_space]
}

resource "azurerm_subnet" "this" {
name = "snet-${local.eln}-ca"
resource_group_name = azurerm_resource_group.platform.name
virtual_network_name = azurerm_virtual_network.this.name
address_prefixes = ["10.0.0.0/20"]
address_prefixes = [var.network.subnet_address_prefix]
}

# FIXME: Add zone_redundant when supported: https://github.com/hashicorp/terraform-provider-azurerm/issues/20538
Expand Down
12 changes: 12 additions & 0 deletions terraform-module/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,15 @@ variable "add_permissions_to_current_user" {
type = bool
default = false
}

variable "network" {
description = "The network configuration"
type = object({
virtual_network_address_space = string
subnet_address_prefix = string
})
default = {
virtual_network_address_space = "10.0.0.0/16"
subnet_address_prefix = "10.0.0.0/20"
}
}

0 comments on commit f7fdecb

Please sign in to comment.