Skip to content

Commit

Permalink
Add variable subnet_enforce_private_link_endpoint_network_policies (#…
Browse files Browse the repository at this point in the history
…51)

* 0.13

* update

* update

* update

* update

* update

* update

* update

* update
  • Loading branch information
yupwei68 authored Jan 21, 2021
1 parent ccb652f commit dc1d416
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ module "network" {
subnet_prefixes = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
subnet_names = ["subnet1", "subnet2", "subnet3"]
subnet_enforce_private_link_endpoint_network_policies = {
"subnet1" : true
}
tags = {
environment = "dev"
costcenter = "it"
Expand Down
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ resource "azurerm_virtual_network" "vnet" {
}

resource "azurerm_subnet" "subnet" {
count = length(var.subnet_names)
name = var.subnet_names[count.index]
resource_group_name = data.azurerm_resource_group.network.name
address_prefixes = [var.subnet_prefixes[count.index]]
virtual_network_name = azurerm_virtual_network.vnet.name
count = length(var.subnet_names)
name = var.subnet_names[count.index]
resource_group_name = data.azurerm_resource_group.network.name
address_prefixes = [var.subnet_prefixes[count.index]]
virtual_network_name = azurerm_virtual_network.vnet.name
enforce_private_link_endpoint_network_policies = lookup(var.subnet_enforce_private_link_endpoint_network_policies, var.subnet_names[count.index], false)
}
4 changes: 4 additions & 0 deletions test/fixture/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ module "network" {
subnet_prefixes = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
subnet_names = ["subnet1", "subnet2", "subnet3"]

subnet_enforce_private_link_endpoint_network_policies = {
"subnet1" : true
}

tags = {
environment = "dev"
costcenter = "it"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ variable "tags" {
environment = "dev"
}
}

variable "subnet_enforce_private_link_endpoint_network_policies" {
description = "A map with key (string) `subnet name`, value (bool) `true` or `false` to indicate enable or disable network policies for the private link endpoint on the subnet. Default value is false."
type = map(bool)
default = {}
}

0 comments on commit dc1d416

Please sign in to comment.