forked from heoelri/locust-on-aci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
containers.tf
97 lines (78 loc) · 2.87 KB
/
containers.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
resource "azurerm_container_group" "master" {
count = var.locustWorkerNodes >= 1 ? 1 : 0
name = "${random_pet.deployment.id}-locust-master"
location = azurerm_resource_group.deployment.location
resource_group_name = azurerm_resource_group.deployment.name
ip_address_type = "Public"
dns_name_label = "${random_pet.deployment.id}-locust-master"
os_type = "Linux"
container {
name = "${random_pet.deployment.id}-locust-master"
image = var.locust_container_image
cpu = "2"
memory = "2"
commands = [
"locust"
]
environment_variables = {
"LOCUST_LOCUSTFILE" = "/home/locust/locust/${azurerm_storage_share_file.locustfile.name}",
"LOCUST_HOST" = var.targeturl,
"LOCUST_MODE_MASTER" = "true"
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.deployment.instrumentation_key
}
secure_environment_variables = {
"LOCUST_WEB_AUTH" = "locust:${random_password.locustsecret.result}",
}
volume {
name = "locust"
mount_path = "/home/locust/locust"
storage_account_key = azurerm_storage_account.deployment.primary_access_key
storage_account_name = azurerm_storage_account.deployment.name
share_name = azurerm_storage_share.locust.name
}
ports {
port = "8089"
protocol = "TCP"
}
ports {
port = "5557"
protocol = "TCP"
}
}
tags = local.default_tags
}
resource "azurerm_container_group" "worker" {
count = var.locustWorkerNodes
name = "${random_pet.deployment.id}-locust-worker-${count.index}"
location = var.locustWorkerLocations[count.index % length(var.locustWorkerLocations)]
resource_group_name = azurerm_resource_group.deployment.name
ip_address_type = "Public"
os_type = "Linux"
container {
name = "${random_pet.deployment.id}-worker-${count.index}"
image = var.locust_container_image
cpu = "2"
memory = "2"
commands = [
"locust"
]
environment_variables = {
"LOCUST_LOCUSTFILE" = "/home/locust/locust/${azurerm_storage_share_file.locustfile.name}",
"LOCUST_MASTER_NODE_HOST" = azurerm_container_group.master[0].fqdn,
"LOCUST_MODE_WORKER" = "true"
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.deployment.instrumentation_key
}
volume {
name = "locust"
mount_path = "/home/locust/locust"
storage_account_key = azurerm_storage_account.deployment.primary_access_key
storage_account_name = azurerm_storage_account.deployment.name
share_name = azurerm_storage_share.locust.name
}
ports {
port = 8089
protocol = "TCP"
}
}
tags = local.default_tags
}