Skip to content

Commit

Permalink
alow pre-configured IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin-DynamicD committed Mar 25, 2022
1 parent b080d90 commit 40d7b9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agw.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Public Ip
resource "azurerm_public_ip" "main" {
count = local.app_gateway.enabled ? 1 : 0
count = (local.app_gateway.enabled && local.app_gateway.public_ip_id == "") ? 1 : 0
name = local.names.agw
resource_group_name = local.global_settings.resource_group_name
location = local.global_settings.location
Expand Down Expand Up @@ -48,7 +48,7 @@ resource "azurerm_application_gateway" "main" {
}
frontend_ip_configuration {
name = "appGatewayFrontendIP"
public_ip_address_id = azurerm_public_ip.main[0].id
public_ip_address_id = local.app_gateway.public_ip_id == "" ? azurerm_public_ip.main[0].id : local.app_gateway.public_ip_id
}
backend_address_pool {
name = "defaultaddresspool"
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ locals {
app_gateway = defaults(var.app_gateway, {
enabled = false
name = ""
public_ip_id = ""
sku_capacity = "2"
sku_name = "WAF_v2"
sku_tier = "WAF_v2"
Expand Down
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ variable app_gateway {
type = object ({
enabled = optional(bool)
name = optional(string)
public_ip_id = optional(string)
sku_capacity = optional(string)
sku_name = optional(string)
sku_tier = optional(string)
Expand Down

0 comments on commit 40d7b9d

Please sign in to comment.