-
Notifications
You must be signed in to change notification settings - Fork 0
/
webapps.tf
38 lines (33 loc) · 1.17 KB
/
webapps.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
resource "azurerm_resource_group" "webapps" {
name = "webapps"
location = var.loc
tags = var.tags
}
resource "random_string" "webapprnd" {
length = 8
lower = true
number = true
upper = false
special = false
}
resource "azurerm_app_service_plan" "free" {
count = length(var.webapplocs)
name = "plan-free-${var.webapplocs[count.index]}"
location = var.webapplocs[count.index]
resource_group_name = azurerm_resource_group.webapps.name
tags = azurerm_resource_group.webapps.tags
kind = "Linux"
reserved = true
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "citadel" {
count = length(var.webapplocs)
name = "webapp-${random_string.webapprnd.result}-${var.webapplocs[count.index]}"
location = var.webapplocs[count.index]
resource_group_name = azurerm_resource_group.webapps.name
tags = azurerm_resource_group.webapps.tags
app_service_plan_id = element(azurerm_app_service_plan.free.*.id, count.index)
}