Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
File renamed without changes.
15 changes: 15 additions & 0 deletions Deployment/set_subnet_configuration.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
param (
[Parameter(Mandatory = $true)] [string] $mockresourcegroup,
[Parameter(Mandatory = $true)] [string] $mockwebappname,
[Parameter(Mandatory = $true)] [string] $subscriptionid,
[Parameter(Mandatory = $true)] [string] $vnetresourcegroup,
[Parameter(Mandatory = $true)] [string] $vnetname,
[Parameter(Mandatory = $true)] [string] $subnetname
)

Write-Output "Set Subnet in Mock Network Configuration ..."
az webapp config access-restriction add -g $mockresourcegroup -n $mockwebappname --action Allow --subnet "/subscriptions/$subscriptionid/resourceGroups/$vnetresourcegroup/providers/Microsoft.Network/virtualNetworks/$vnetname/subnets/$subnetname" --priority 65000 --scm-site false -i




Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ resource "azurerm_windows_web_app" "pks_mock_webapp_service" {
resource "azurerm_app_service_virtual_network_swift_connection" "pks_mock_webapp_vnet_integration" {
app_service_id = azurerm_windows_web_app.pks_mock_webapp_service.id
subnet_id = var.subnet_id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ output "web_app_tenant_id" {

output "default_site_hostname" {
value = azurerm_windows_web_app.mock_webapp_service.default_hostname
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "azurerm_storage_account" "bess_storage" {
default_action = "Deny"
ip_rules = var.allowed_ips
bypass = ["Logging", "Metrics", "AzureServices"]
virtual_network_subnet_ids = [var.m_spoke_subnet, var.agent_2204_subnet, var.agent_prd_subnet]
virtual_network_subnet_ids = compact([var.m_spoke_subnet, var.mock_spoke_subnet, var.agent_2204_subnet, var.agent_prd_subnet])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ resource "azurerm_windows_web_app" "webapp_service" {
resource "azurerm_app_service_virtual_network_swift_connection" "webapp_vnet_integration" {
app_service_id = azurerm_windows_web_app.webapp_service.id
subnet_id = var.subnet_id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ output "username" {
output "password" {
value = azurerm_windows_web_app.webapp_service.site_credential[0].password
sensitive = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ variable "app_settings" {
}

variable "tags" {

}

variable "env_name" {
Expand All @@ -30,10 +29,14 @@ variable "subnet_id" {
type = string
}

variable "main_subnet_id" {
type = string
variable "allowed_ips" {
}

variable "allowed_ips" {

variable "agent_2204_subnet" {
type = string
}

variable "agent_prd_subnet" {
type = string
}
File renamed without changes.
39 changes: 24 additions & 15 deletions DevDeployment/src/main.tf → Deployment/src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,12 @@ data "azurerm_subnet" "main_subnet" {
}

data "azurerm_subnet" "mock_main_subnet" {
count = "${local.env_name}" == "dev" ? 1 : 0
name = var.mock_spoke_subnet_name
virtual_network_name = var.spoke_vnet_name
resource_group_name = var.spoke_rg
}

data "azurerm_app_service_plan" "essft_asp" {
name = "essft-qc-yh3r1-asp"
resource_group_name = "essft-qc-webapp-rg"
}

data "azurerm_app_service_plan" "ess_asp" {
name = "ess-${local.env_name}-lxs-1-asp"
resource_group_name = "ess-${local.env_name}-rg"
}

module "app_insights" {
source = "./Modules/AppInsights"
name = "${local.service_name}-${local.env_name}-insights"
Expand All @@ -37,15 +28,27 @@ module "eventhub" {
env_name = local.env_name
}

data "azurerm_app_service_plan" "essft_asp" {
count = "${local.env_name}" == "dev" ? 1 : 0
name = "essft-qc-yh3r1-asp"
resource_group_name = "essft-qc-webapp-rg"
}

data "azurerm_app_service_plan" "ess_asp" {
name = "ess-${local.env_name}-lxs-1-asp"
resource_group_name = "ess-${local.env_name}-rg"
}

module "mock_webapp_service" {
count = "${local.env_name}" == "dev" ? 1 : 0
source = "./Modules/MockWebApp"
name = local.mock_web_app_name
pks_name = local.pks_mock_web_app_name
env_name = local.env_name
resource_group_name = azurerm_resource_group.mock_webapp_rg.name
service_plan_id = data.azurerm_app_service_plan.essft_asp.id
service_plan_id = data.azurerm_app_service_plan.essft_asp[0].id
location = azurerm_resource_group.mock_webapp_rg.location
subnet_id = data.azurerm_subnet.mock_main_subnet.id
subnet_id = data.azurerm_subnet.mock_main_subnet[0].id
main_subnet_id = data.azurerm_subnet.main_subnet.id
app_settings = {
"ASPNETCORE_ENVIRONMENT" = local.env_name
Expand All @@ -65,11 +68,13 @@ module "webapp_service" {
env_name = local.env_name
location = azurerm_resource_group.webapp_rg.location
subnet_id = data.azurerm_subnet.main_subnet.id
agent_2204_subnet = var.agent_2204_subnet
agent_prd_subnet = var.agent_prd_subnet
app_settings = {
"EventHubLoggingConfiguration:Environment" = local.env_name
"EventHubLoggingConfiguration:MinimumLoggingLevel" = "Warning"
"EventHubLoggingConfiguration:UkhoMinimumLoggingLevel" = "Information"
"APPINSIGHTS_INSTRUMENTATIONKEY" = module.app_insights.instrumentation_key
"APPINSIGHTS_INSTRUMENTATIONKEY" = module.app_insights.instrumentation_key
"ASPNETCORE_ENVIRONMENT" = local.env_name
"WEBSITE_RUN_FROM_PACKAGE" = "1"
"WEBSITE_ENABLE_SYNC_UPDATE_SITE" = "true"
Expand All @@ -90,13 +95,17 @@ module "webapp_service" {
allowed_ips = var.allowed_ips
}

locals {
mock_main_subnet_id = (length(data.azurerm_subnet.mock_main_subnet) > 0 ? data.azurerm_subnet.mock_main_subnet[0].id : null)
}

module "storage" {
source = "./Modules/Storage"
resource_group_name = azurerm_resource_group.webapp_rg.name
location = azurerm_resource_group.webapp_rg.location
allowed_ips = var.allowed_ips
m_spoke_subnet = data.azurerm_subnet.main_subnet.id
mock_spoke_subnet = data.azurerm_subnet.mock_main_subnet.id
mock_spoke_subnet = local.mock_main_subnet_id
agent_2204_subnet = var.agent_2204_subnet
agent_prd_subnet = var.agent_prd_subnet
env_name = local.env_name
Expand All @@ -113,7 +122,7 @@ module "key_vault" {
env_name = local.env_name
tenant_id = module.webapp_service.web_app_tenant_id
allowed_ips = var.allowed_ips
allowed_subnet_ids = [data.azurerm_subnet.main_subnet.id, var.agent_2204_subnet,var.agent_prd_subnet]
allowed_subnet_ids = [data.azurerm_subnet.main_subnet.id, var.agent_2204_subnet, var.agent_prd_subnet]
location = azurerm_resource_group.webapp_rg.location
agent_2204_subnet = var.agent_2204_subnet
agent_prd_subnet = var.agent_prd_subnet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ output "pks_mock_webappname" {
}

output "fm_mock_web_app_url" {
value = "https://${module.mock_webapp_service.default_site_hostname}"
value = length(module.mock_webapp_service) > 0 ? "https://${module.mock_webapp_service[0].default_site_hostname}" : null
}

output "mock_webapp_rg" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ locals {
SERVICE_OWNER = "UKHO"
RESPONSIBLE_TEAM = "Abzu"
CALLOUT_TEAM = "On-Call_N/A"
COST_CENTRE = "A.008.02"
COST_CENTRE = local.env_name == "dev" || local.env_name == "qa" || local.env_name == "prod" ? "A.008.02" : "A.011.08"
}
}

Expand All @@ -40,6 +40,14 @@ variable "spoke_subnet_name" {
type = string
}

variable "agent_rg" {
type = string
}

variable "agent_vnet_name" {
type = string
}

variable "mock_spoke_subnet_name" {
type = string
}
Expand All @@ -58,15 +66,15 @@ variable "elastic_apm_server_url" {
variable "elastic_apm_api_key" {
}

variable "agent_2204_subnet" {
variable "permitdecryptionhardwareid" {
type = string
}

variable "agent_prd_subnet" {
variable "agent_2204_subnet" {
type = string
}

variable "permitdecryptionhardwareid" {
variable "agent_prd_subnet" {
type = string
}

Expand Down
Loading
Loading