Skip to content

Commit

Permalink
Added new Linux and Windows App service and Linux Function (#39)
Browse files Browse the repository at this point in the history
Added linux/windows apps and linux function new modules
  • Loading branch information
kevindelmont authored Oct 31, 2024
1 parent 15545a2 commit 790b0ba
Show file tree
Hide file tree
Showing 36 changed files with 2,860 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/standalone-scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@
"webapps/appservice/107-appservice-private",
"webapps/appservice/109-appservice-appgw",
"webapps/appservice/110-appservice-auth",
"webapps/appservice/111-windows-web-app",
"webapps/appservice/112-windows-web-app-private",
"webapps/appservice/113-linux-web-app",
"webapps/appservice/114-linux-web-app-private",
"webapps/function_app/101-function_app-private",
"webapps/function_app/102-function_app-linux",
"webapps/function_app/103-function_app-windows",
"webapps/windows_function_app/102-function_app-linux",
"webapps/windows_function_app/103-function_app-windows",
"webapps/static_site/101-simple-static-web-app"
]
Expand Down
67 changes: 67 additions & 0 deletions app_services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,70 @@ resource "azurerm_app_service_virtual_network_swift_connection" "vnet_config" {
app_service_id = module.app_services[each.key].id
subnet_id = local.combined_objects_networking[try(each.value.vnet_integration.lz_key, local.client_config.landingzone_key)][each.value.vnet_integration.vnet_key].subnets[each.value.vnet_integration.subnet_key].id
}

module "windows_web_apps" {
source = "./modules/webapps/windows_webapps"
depends_on = [module.networking]
for_each = local.webapp.windows_web_apps
name = each.value.name
client_config = local.client_config
dynamic_app_settings = try(each.value.dynamic_app_settings, {})
app_service_plan_id = can(each.value.app_service_plan_id) ? each.value.app_service_plan_id : local.combined_objects_app_service_plans[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.app_service_plan_key].id
combined_objects = local.dynamic_app_settings_combined_objects
global_settings = local.global_settings
settings = each.value.settings
identity = try(each.value.identity, null)
app_settings = try(each.value.app_settings, null)
connection_string = try(each.value.connection_string, {})
vnets = local.combined_objects_networking
virtual_subnets = local.combined_objects_virtual_subnets
subnet_id = can(each.value.subnet_id) || can(each.value.vnet_key) == false ? try(each.value.subnet_id, null) : local.combined_objects_networking[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.vnet_key].subnets[each.value.subnet_key].id
remote_objects = {
subnets = try(local.combined_objects_networking[try(each.value.settings.lz_key, local.client_config.landingzone_key)][each.value.settings.vnet_key].subnets, null)
}
private_endpoints = try(each.value.private_endpoints, {})
private_dns = local.combined_objects_private_dns
base_tags = local.global_settings.inherit_tags
resource_group = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)]
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : null
location = try(local.global_settings.regions[each.value.region], null)
azuread_applications = local.combined_objects_azuread_applications
azuread_service_principal_passwords = local.combined_objects_azuread_service_principal_passwords
}

output "windows_web_apps" {
value = module.windows_web_apps
}

module "linux_web_apps" {
source = "./modules/webapps/linux_webapps"
depends_on = [module.networking]
for_each = local.webapp.linux_web_apps
name = each.value.name
client_config = local.client_config
dynamic_app_settings = try(each.value.dynamic_app_settings, {})
app_service_plan_id = can(each.value.app_service_plan_id) ? each.value.app_service_plan_id : local.combined_objects_app_service_plans[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.app_service_plan_key].id
combined_objects = local.dynamic_app_settings_combined_objects
global_settings = local.global_settings
settings = each.value.settings
identity = try(each.value.identity, null)
app_settings = try(each.value.app_settings, null)
connection_string = try(each.value.connection_string, {})
vnets = local.combined_objects_networking
virtual_subnets = local.combined_objects_virtual_subnets
subnet_id = can(each.value.subnet_id) || can(each.value.vnet_key) == false ? try(each.value.subnet_id, null) : local.combined_objects_networking[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.vnet_key].subnets[each.value.subnet_key].id
remote_objects = {
subnets = try(local.combined_objects_networking[try(each.value.settings.lz_key, local.client_config.landingzone_key)][each.value.settings.vnet_key].subnets, null)
}
private_endpoints = try(each.value.private_endpoints, {})
private_dns = local.combined_objects_private_dns
base_tags = local.global_settings.inherit_tags
resource_group = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)]
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : null
location = try(local.global_settings.regions[each.value.region], null)
azuread_applications = local.combined_objects_azuread_applications
azuread_service_principal_passwords = local.combined_objects_azuread_service_principal_passwords
}
output "linux_web_apps" {
value = module.linux_web_apps
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
global_settings = {
default_region = "region1"
regions = {
region1 = "australiaeast"
}
inherit_tags = true
tags = {
env = "to_be_set"
}
}

resource_groups = {
windows_webapp_simple = {
name = "windows-webapp-simple"
region = "region1"
}
}

# By default asp1 will inherit from the resource group location
app_service_plans = {
asp1 = {
resource_group_key = "windows_webapp_simple"
name = "asp-simple"

sku = {
tier = "Standard"
size = "S1"
}
tags = {
env = "uat"
}
}
}

windows_web_apps = {
windows_web_app_simple = {
name = "windows-web-app-simple"
resource_group_key = "windows_webapp_simple"
app_service_plan_key = "asp1"

settings = {
https_only = "true"
always_on = "false"

site_config = {
ftps_state = "Disabled"
always_on = "false"

application_stack = {
current_stack = "dotnetcore"
dotnet_core_version = "v4.0"
}
}
}
app_settings = {
example_setting = "example-setting"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
global_settings = {
default_region = "region1"
regions = {
region1 = "australiaeast"
}
inherit_tags = true
tags = {
env = "to_be_set"
}
}

resource_groups = {
windows_webapp_private = {
name = "windows-webapp-private"
region = "region1"
}
}

# By default asp1 will inherit from the resource group location
app_service_plans = {
asp1 = {
resource_group_key = "windows_webapp_private"
name = "asp-simple"

sku = {
tier = "Standard"
size = "S1"
}
tags = {
env = "uat"
}
}
}


vnets = {
demo_vnet = {
resource_group_key = "windows_webapp_private"
region = "region1"
vnet = {
name = "demo-vnet"
address_space = ["10.0.0.0/8"]
}

subnets = {
demo_subnet = {
name = "demo-subnet"
cidr = ["10.0.1.0/24"]
#nsg_key = ""
enforce_private_link_endpoint_network_policies = true
delegation = {
name = "serverFarms"
service_delegation = "Microsoft.Web/serverFarms"
actions = [
"Microsoft.Network/virtualNetworks/subnets/action"
]
}
}
}
}


windows_web_apps = {
windows_web_app_private = {
name = "windows-web-app-private"
resource_group_key = "windows_webapp_private"
app_service_plan_key = "asp1"

settings = {
https_only = "true"
always_on = "false"
public_network_access_enabled = false
virtual_network_subnet = {
subnet_key = "demo_subnet"
vnet_key = "demo_vnet"
#lz_key = ""
}
site_config = {
ftps_state = "Disabled"
always_on = "false"

application_stack = {
current_stack = "dotnetcore"
dotnet_core_version = "v4.0"
}
ip_restriction_default_action = "Deny"
ip_restriction = [
{
name = "demo-iprestriction"
priority = "100"
ip_address = "192.168.1.0/24"
# virtual_network_subnet = {
# subnet_key = "demo_subnet"
# vnet_key = "demo_vnet"
# lz_key = ""
# }
action = "Allow"
}
]
}
}
app_settings = {
example_setting = "example-setting"
}
}
}
59 changes: 59 additions & 0 deletions examples/webapps/appservice/113-linux-web-app/configuration.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
global_settings = {
default_region = "region1"
regions = {
region1 = "australiaeast"
}
inherit_tags = true
tags = {
env = "to_be_set"
}
}

resource_groups = {
linux_webapp_simple = {
name = "linux-webapp-simple"
region = "region1"
}
}

# By default asp1 will inherit from the resource group location
app_service_plans = {
asp1 = {
resource_group_key = "linux_webapp_simple"
name = "asp-simple"

sku = {
tier = "Standard"
size = "S1"
}
tags = {
env = "uat"
}
}
}

linux_web_apps = {
linux_web_app_simple = {
name = "linux-web-app-simple"
resource_group_key = "linux_webapp_simple"
app_service_plan_key = "asp1"

settings = {
https_only = "true"
always_on = "false"

site_config = {
ftps_state = "Disabled"
always_on = "false"

application_stack = {
java_server = "JAVA"
java_version = "11"
}
}
}
app_settings = {
example_setting = "example-setting"
}
}
}
Loading

0 comments on commit 790b0ba

Please sign in to comment.