-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebapps.tf
42 lines (36 loc) · 1.23 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
39
40
41
42
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 = 3
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 = "Free"
size = "F1"
}
}
resource "azurerm_app_service" "citadel" {
count = 3
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)}"
}
output "webapp_ids" {
value = "${azurerm_app_service.citadel.*.id}"
}