Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Forced Tunneling to the Hub Firewall configuration #202

Merged
merged 17 commits into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,22 @@ RUN wget -O terraform.zip https://releases.hashicorp.com/terraform/0.13.4/terraf
ENV TF_PLUGIN_CACHE_DIR=/usr/lib/tf-plugins
ARG AZURERM_LOCAL_PATH="${TF_PLUGIN_CACHE_DIR}/registry.terraform.io/hashicorp/azurerm/2.55.0/linux_amd64"
ARG RANDOM_LOCAL_PATH="${TF_PLUGIN_CACHE_DIR}/registry.terraform.io/hashicorp/random/3.1.0/linux_amd64"
ARG TIME_LOCAL_PATH="${TF_PLUGIN_CACHE_DIR}/registry.terraform.io/hashicorp/time/0.7.1/linux_amd64"
ARG AZURERM_PROVIDER=https://releases.hashicorp.com/terraform-provider-azurerm/2.55.0/terraform-provider-azurerm_2.55.0_linux_amd64.zip
ARG RANDOM_PROVIDER=https://releases.hashicorp.com/terraform-provider-random/3.1.0/terraform-provider-random_3.1.0_linux_amd64.zip
ARG TIME_PROVIDER=https://releases.hashicorp.com/terraform-provider-time/0.7.1/terraform-provider-time_0.7.1_linux_amd64.zip
RUN wget -O azurerm.zip ${AZURERM_PROVIDER} \
&& wget -O random.zip ${RANDOM_PROVIDER} \
&& wget -O time.zip ${TIME_PROVIDER} \
&& mkdir -p ${AZURERM_LOCAL_PATH} \
&& mkdir -p ${RANDOM_LOCAL_PATH} \
&& mkdir -p ${TIME_LOCAL_PATH} \
&& unzip azurerm.zip -d ${AZURERM_LOCAL_PATH} \
&& unzip random.zip -d ${RANDOM_LOCAL_PATH} \
&& unzip time.zip -d ${TIME_LOCAL_PATH} \
&& rm azurerm.zip \
&& rm random.zip
&& rm random.zip \
&& rm time.zip

# Install the Microsoft package key
RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
Expand Down
47 changes: 28 additions & 19 deletions src/core/saca-hub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ provider "azurerm" {
provider "random" {
}

provider "time" {
version = "0.7.1"
}

resource "azurerm_resource_group" "hub" {
location = var.mlz_location
name = var.saca_rgname
Expand All @@ -43,13 +47,15 @@ resource "azurerm_resource_group" "hub" {
}

module "saca-hub-network" {
depends_on = [azurerm_resource_group.hub]
source = "../../modules/hub"
location = var.mlz_location
resource_group_name = azurerm_resource_group.hub.name
vnet_name = var.saca_vnetname
vnet_address_space = var.vnet_address_space
firewall_address_space = var.firewall_address_space
depends_on = [azurerm_resource_group.hub]
source = "../../modules/hub"
location = var.mlz_location
resource_group_name = azurerm_resource_group.hub.name
vnet_name = var.saca_vnetname
vnet_address_space = var.vnet_address_space
client_address_space = var.client_address_space
management_address_space = var.management_address_space
routetable_name = var.management_routetable_name

log_analytics_workspace_name = var.saca_lawsname
log_analytics_workspace_sku = "PerGB2018"
Expand All @@ -66,18 +72,21 @@ locals {
}

module "saca-firewall" {
depends_on = [module.saca-hub-network]
source = "../../modules/firewall"
location = var.mlz_location
resource_group_name = module.saca-hub-network.resource_group_name
vnet_name = module.saca-hub-network.virtual_network_name
vnet_address_space = module.saca-hub-network.virtual_network_address_space
firewall_sku = contains(local.firewall_premium_tf_environments, lower(var.tf_environment)) ? "Premium" : "Standard"
firewall_subnet_name = module.saca-hub-network.firewall_subnet_name
firewall_address_space = var.firewall_address_space
saca_fwname = var.saca_fwname
firewall_ipconfig_name = var.firewall_ipconfig_name
public_ip_name = var.public_ip_name
depends_on = [module.saca-hub-network]
source = "../../modules/firewall"
location = var.mlz_location
resource_group_name = module.saca-hub-network.resource_group_name
vnet_name = module.saca-hub-network.virtual_network_name
vnet_address_space = module.saca-hub-network.virtual_network_address_space
firewall_sku = contains(local.firewall_premium_tf_environments, lower(var.tf_environment)) ? "Premium" : "Standard"
fw_client_sn_name = module.saca-hub-network.fw_client_subnet_name
fw_mgmt_sn_name = module.saca-hub-network.fw_mgmt_subnet_name
Phydeauxman marked this conversation as resolved.
Show resolved Hide resolved
client_address_space = var.client_address_space
firewall_name = var.firewall_name
client_ipconfig_name = var.client_ipconfig_name
client_publicip_name = var.client_publicip_name
management_ipconfig_name = var.management_ipconfig_name
management_publicip_name = var.management_publicip_name

log_analytics_workspace_id = module.saca-hub-network.log_analytics_workspace_id

Expand Down
4 changes: 2 additions & 2 deletions src/core/saca-hub/saca-hub.front.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
"options": []
},
{
"varname": "firewall_address_space",
"varname": "client_address_space",
"type": "text",
"default_val": "10.0.100.0/26",
"description": "Address space for the firewall",
"options": []
},
{
"varname": "saca_fwname",
"varname": "firewall_name",
"type": "text",
"default_val": "DemoFirewall",
"description": "Saca Firewall Name",
Expand Down
11 changes: 7 additions & 4 deletions src/core/saca-hub/saca-hub.orig.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
"tier1_vnetname": "{TIER1_VNETNAME}",
"tier2_rgname": "{TIER2_RGNAME}",
"tier2_vnetname": "{TIER2_VNETNAME}",
"firewall_address_space": "{SACA_FWSPACE}",
"saca_fwname": "{SACA_FWNAME}",
"firewall_ipconfig_name": "{SACA_FWIPCONFIGNAME}",
"public_ip_name": "{SACA_FWPIPNAME}",
"client_address_space": "{FIREWALL_CLIENT_SPACE}",
"management_address_space": "{FIREWALL_MANAGEMENT_SPACE}",
"firewall_name": "{FIREWALL_NAME}",
"client_ipconfig_name": "{FIREWALL_CLIENT_IPCONFIG_NAME}",
"client_publicip_name": "{FIREWALL_CLIENT_PUBLICIP_NAME}",
"management_ipconfig_name": "{FIREWALL_MANAGEMENT_IPCONFIG_NAME}",
"management_publicip_name": "{FIREWALL_MANAGEMENT_PUBLICIP_NAME}",
Phydeauxman marked this conversation as resolved.
Show resolved Hide resolved
"create_network_watcher": false
}
12 changes: 8 additions & 4 deletions src/core/saca-hub/saca-hub.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ tier2_vnetname = "{TIER2_VNETNAME}"
# Firewall configuration section
#################################

firewall_address_space = "{SACA_FWSPACE}"
saca_fwname = "{SACA_FWNAME}"
firewall_ipconfig_name = "{SACA_FWIPCONFIGNAME}"
public_ip_name = "{SACA_FWPIPNAME}"
client_address_space = "{FIREWALL_CLIENT_SPACE}"
management_address_space = "{FIREWALL_MANAGEMENT_SPACE}"
firewall_name = "{FIREWALL_NAME}"
client_ipconfig_name = "{FIREWALL_CLIENT_IPCONFIG_NAME}"
client_publicip_name = "{FIREWALL_CLIENT_PUBLICIP_NAME}"
management_ipconfig_name = "{FIREWALL_MANAGEMENT_IPCONFIG_NAME}"
management_publicip_name = "{FIREWALL_MANAGEMENT_PUBLICIP_NAME}"
management_routetable_name = "{FIREWALL_MANAGEMENT_ROUTE_TABLE_NAME}"
37 changes: 29 additions & 8 deletions src/core/saca-hub/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,46 @@ variable "vnet_address_space" {
# Firewall configuration section
#################################

variable "firewall_address_space" {
variable "client_address_space" {
description = "The address space to be used for the Firewall virtual network."
default = "10.0.100.0/26"
type = string
}

variable "saca_fwname" {
variable "management_address_space" {
description = "The address space to be used for the Firewall virtual network subnet used for management traffic."
default = "10.0.100.64/26"
type = string
}

variable "firewall_name" {
description = "Name of the Hub Firewall"
default = "mlzDemoFirewall"
}

variable "firewall_ipconfig_name" {
description = "The name of the Firewall IP Configuration"
default = "mlzDemoFirewallIpConfiguration"
variable "client_ipconfig_name" {
description = "The name of the Firewall Client IP Configuration"
default = "mlzDemoFWClientIpCfg"
}

variable "client_publicip_name" {
description = "The name of the Firewall Client Public IP"
default = "mlzDemoFWClientPip"
}

variable "management_ipconfig_name" {
description = "The name of the Firewall Management IP Configuration"
default = "mlzDemoFWMgmtIpCfg"
}

variable "management_publicip_name" {
description = "The name of the Firewall Management Public IP"
default = "mlzDemoFWMgmtPip"
}

variable "public_ip_name" {
description = "The name of the Firewall Public IP"
default = "mlzDemoFirewallPip"
variable "management_routetable_name" {
description = "The name of the route table applied to the management subnet"
default = "mlzDemoFirewallMgmtRT"
}

variable "create_network_watcher" {
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-0/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ data "azurerm_log_analytics_workspace" "hub" {

data "azurerm_firewall" "firewall" {
provider = azurerm.hub
name = var.saca_fwname
name = var.firewall_name
resource_group_name = data.azurerm_resource_group.hub.name
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-0/tier-0.front.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"options": []
},
{
"varname": "saca_fwname",
"varname": "firewall_name",
"type": "text",
"default_val": "DemoFirewall",
"description": "Saca Firewall Name",
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-0/tier-0.orig.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"saca_subid": "{SACA_SUBID}",
"saca_rgname": "{SACA_RGNAME}",
"saca_vnetname": "{SACA_VNETNAME}",
"saca_fwname": "{SACA_FWNAME}",
"firewall_name": "{firewall_name}",
"saca_lawsname": "{SACA_LAWSNAME}",
"tier0_subid": "{TIER0_SUBID}",
"tier0_rgname": "{TIER0_RGNAME}",
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-0/tier-0.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ deploymentname = "{TIER0_DEPLOYMENTNAME}"
saca_subid = "{SACA_SUBID}"
saca_rgname = "{SACA_RGNAME}"
saca_vnetname = "{SACA_VNETNAME}"
saca_fwname = "{SACA_FWNAME}"
firewall_name = "{firewall_name}"
saca_lawsname = "{SACA_LAWSNAME}"
tier0_subid = "{TIER0_SUBID}"
tier0_rgname = "{TIER0_RGNAME}"
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-0/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ variable "saca_lawsname" {
description = "Log Analytics Workspace name for the deployment"
}

variable "saca_fwname" {
variable "firewall_name" {
description = "Name of the Hub Firewall"
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-1/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ data "azurerm_log_analytics_workspace" "hub" {

data "azurerm_firewall" "firewall" {
provider = azurerm.hub
name = var.saca_fwname
name = var.firewall_name
resource_group_name = data.azurerm_resource_group.hub.name
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-1/tier-1.front.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"options": []
},
{
"varname": "saca_fwname",
"varname": "firewall_name",
"type": "text",
"default_val": "DemoFirewall",
"description": "Saca Firewall Name",
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-1/tier-1.orig.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"saca_subid": "{SACA_SUBID}",
"saca_rgname": "{SACA_RGNAME}",
"saca_vnetname": "{SACA_VNETNAME}",
"saca_fwname": "{SACA_FWNAME}",
"firewall_name": "{firewall_name}",
"saca_lawsname": "{SACA_LAWSNAME}",
"tier1_subid": "{TIER1_SUBID}",
"tier1_rgname": "{TIER1_RGNAME}",
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-1/tier-1.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ deploymentname = "{TIER1_DEPLOYMENTNAME}"
saca_subid = "{SACA_SUBID}"
saca_rgname = "{SACA_RGNAME}"
saca_vnetname = "{SACA_VNETNAME}"
saca_fwname = "{SACA_FWNAME}"
firewall_name = "{firewall_name}"
saca_lawsname = "{SACA_LAWSNAME}"
tier1_subid = "{TIER1_SUBID}"
tier1_rgname = "{TIER1_RGNAME}"
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-1/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ variable "saca_lawsname" {
description = "Log Analytics Workspace name for the deployment"
}

variable "saca_fwname" {
variable "firewall_name" {
description = "Name of the Hub Firewall"
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ data "azurerm_log_analytics_workspace" "hub" {

data "azurerm_firewall" "firewall" {
provider = azurerm.hub
name = var.saca_fwname
name = var.firewall_name
resource_group_name = data.azurerm_resource_group.hub.name
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-2/tier-2.front.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"options": []
},
{
"varname": "saca_fwname",
"varname": "firewall_name",
"type": "text",
"default_val": "DemoFirewall",
"description": "Saca Firewall Name",
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-2/tier-2.orig.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"saca_subid":"{SACA_SUBID}",
"saca_rgname":"{SACA_RGNAME}",
"saca_vnetname":"{SACA_VNETNAME}",
"saca_fwname":"{SACA_FWNAME}",
"firewall_name":"{firewall_name}",
"saca_lawsname":"{SACA_LAWSNAME}",
"tier2_subid":"{TIER2_SUBID}",
"tier2_rgname":"{TIER2_RGNAME}",
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-2/tier-2.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ deploymentname = "{TIER2_DEPLOYMENTNAME}"
saca_subid = "{SACA_SUBID}"
saca_rgname = "{SACA_RGNAME}"
saca_vnetname = "{SACA_VENTNAME}"
saca_fwname = "{SACA_FWNAME}"
firewall_name = "{firewall_name}"
saca_lawsname = "{SACA_LAWSNAME}"
tier2_subid = "{TIER2_SUBID}"
tier2_rgname = "{TIER2_RGNAME}"
Expand Down
2 changes: 1 addition & 1 deletion src/core/tier-2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ variable "saca_lawsname" {
description = "Log Analytics Workspace name for the deployment"
}

variable "saca_fwname" {
variable "firewall_name" {
description = "Name of the Hub Firewall"
}

Expand Down
Loading