-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapps.tf
166 lines (132 loc) · 5.45 KB
/
apps.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Storage account for Function Apps
resource "azurerm_storage_account" "sa1" {
name = "dnsexamplesa"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
}
# App Service Plan for Function Apps
resource "azurerm_service_plan" "asp" {
name = "dns-asp"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
os_type = "Windows"
sku_name = "P1v2"
}
# Function App 1
resource "azurerm_windows_function_app" "app1" {
name = "dns-app1"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
storage_account_name = azurerm_storage_account.sa1.name
storage_account_access_key = azurerm_storage_account.sa1.primary_access_key
service_plan_id = azurerm_service_plan.asp.id
virtual_network_subnet_id = azurerm_subnet.subnet1.id
site_config {
# application_stack {
# dotnet_version = "v8.0"
# use_dotnet_isolated_runtime = true
# }
cors {
allowed_origins = [
"https://portal.azure.com"
]
support_credentials = true
}
}
app_settings = {
"APPLICATIONINSIGHTS_CONNECTION_STRING" = azurerm_application_insights.app_insights.connection_string
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.app_insights.instrumentation_key
# "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED" = "1" // allows to target different versions of .Net
# "WEBSITE_RUN_FROM_PACKAGE" = "1"
# "WEBSITE_VNET_ROUTE_ALL" = "1" # Ensures all outbound traffic uses VNet
# "WEBSITE_DNS_SERVER" = "20.105.224.40"
// "10.0.3.4"
//"20.105.224.40" # Uses Azure Private DNS
}
}
# Function App 2
resource "azurerm_windows_function_app" "app2" {
name = "dns-app2"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
storage_account_name = azurerm_storage_account.sa1.name
storage_account_access_key = azurerm_storage_account.sa1.primary_access_key
service_plan_id = azurerm_service_plan.asp.id
virtual_network_subnet_id = azurerm_subnet.subnet2.id
# Disables Public Network Access
public_network_access_enabled = false
site_config {
application_stack {
dotnet_version = "v8.0"
use_dotnet_isolated_runtime = true
}
cors {
allowed_origins = [
"https://portal.azure.com"
]
support_credentials = true
}
}
app_settings = {
"APPLICATIONINSIGHTS_CONNECTION_STRING" = azurerm_application_insights.app_insights.connection_string
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.app_insights.instrumentation_key
# "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED" = "1" // allows to target different versions of .Net
# "WEBSITE_RUN_FROM_PACKAGE" = "1"
# "WEBSITE_VNET_ROUTE_ALL" = "1" // Ensures all outbound traffic goes through VNet
# "WEBSITE_PRIVATE_ENDPOINT_ENABLED" = "1" // Ensures Private Endpoint is enforced
# "WEBSITE_DNS_SERVER" = "20.105.224.40"
# //"10.0.3.5"
# // "20.105.224.40" //"168.63.129.16" // Uses Azure's private DNS resolver
}
}
# # Enforce Private Network Access Only
# ip_restriction {
# name = "Allow-Private-Endpoint"
# priority = 100
# action = "Allow"
# ip_address = null # No specific IPs, use Virtual Network
# virtual_network_subnet_id = azurerm_subnet.subnet3.id # Subnet hosting Private Endpoint
# }
# # Block ALL Public Access
# ip_restriction {
# name = "Deny-Public"
# priority = 200
# action = "Deny"
# ip_address = "0.0.0.0/0" # Blocks all public traffic
# }
# Function App 2
resource "azurerm_windows_function_app" "app3" {
name = "dns-app3"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
storage_account_name = azurerm_storage_account.sa1.name
storage_account_access_key = azurerm_storage_account.sa1.primary_access_key
service_plan_id = azurerm_service_plan.asp.id
# Disables Public Network Access
// public_network_access_enabled = false
site_config {
application_stack {
dotnet_version = "v8.0"
use_dotnet_isolated_runtime = true
}
cors {
allowed_origins = [
"https://portal.azure.com"
]
support_credentials = true
}
}
app_settings = {
"APPLICATIONINSIGHTS_CONNECTION_STRING" = azurerm_application_insights.app_insights.connection_string
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.app_insights.instrumentation_key
# "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED" = "1" // allows to target different versions of .Net
# "WEBSITE_RUN_FROM_PACKAGE" = "1"
# "WEBSITE_VNET_ROUTE_ALL" = "1" // Ensures all outbound traffic goes through VNet
# "WEBSITE_PRIVATE_ENDPOINT_ENABLED" = "1" // Ensures Private Endpoint is enforced
# "WEBSITE_DNS_SERVER" = "20.105.224.40"
# //"10.0.3.5"
# // "20.105.224.40" //"168.63.129.16" // Uses Azure's private DNS resolver
}
}