-
Notifications
You must be signed in to change notification settings - Fork 1
/
AppService-DotNetCore.tf
94 lines (91 loc) · 3.02 KB
/
AppService-DotNetCore.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
resource "azurerm_resource_group" "trainlab-rg" {
name = "trainlab-rg"
location = var.location # Define a location variable for this
}
resource "azurerm_app_service_plan" "webapp-serviceplan" {
name = "webapp-serviceplan"
location = azurerm_resource_group.trainlab-rg.location
resource_group_name = azurerm_resource_group.trainlab-rg.name
sku {
tier = "Free"
size = "F1"
}
}
resource "azurerm_app_service" "webapp-appsvc" {
name = "webapp-appsvc"
location = azurerm_resource_group.trainlab-rg.location
resource_group_name = azurerm_resource_group.trainlab-rg.name
app_service_plan_id = azurerm_app_service_plan.webapp-serviceplan.id
site_config {
http2_enabled = true
always_on = false
use_32_bit_worker_process = true
}
}
resource "azurerm_template_deployment" "webapp-corestack" {
# This will make it .NET CORE for Stack property, and add the dotnet core logging extension
name = "AspNetCoreStack"
resource_group_name = azurerm_resource_group.trainlab-rg.name
template_body = <<DEPLOY
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"siteName": {
"type": "string",
"metadata": {
"description": "The Azure App Service Name"
}
},
"extensionName": {
"type": "string",
"metadata": {
"description": "The Site Extension Name."
}
},
"extensionVersion": {
"type": "string",
"metadata": {
"description": "The Extension Version"
}
}
},
"resources": [
{
"apiVersion": "2018-02-01",
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"properties": {
"name": "[parameters('siteName')]",
"siteConfig": {
"appSettings": [],
"metadata": [
{
"name": "CURRENT_STACK",
"value": "dotnetcore"
}
]
}
}
},
{
"type": "Microsoft.Web/sites/siteextensions",
"name": "[concat(parameters('siteName'), '/', parameters('extensionName'))]",
"apiVersion": "2018-11-01",
"location": "[resourceGroup().location]",
"properties": {
"version": "[parameters('extensionVersion')]"
}
}
]
}
DEPLOY
parameters = {
"siteName" = azurerm_app_service.webapp-appsvc.name
"extensionName" = "Microsoft.AspNetCore.AzureAppServices.SiteExtension"
"extensionVersion" = "3.1.7"
}
deployment_mode = "Incremental"
depends_on = [azurerm_app_service.webapp-appsvc]
}