Skip to content

Instantly share code, notes, and snippets.

@heoelri
Created January 4, 2022 12:05
Show Gist options
  • Save heoelri/8917a61c6e990596b20fb7da7107010b to your computer and use it in GitHub Desktop.
Save heoelri/8917a61c6e990596b20fb7da7107010b to your computer and use it in GitHub Desktop.
Locust main TF file specifying the master nodes
resource "azurerm_container_group" "master" {
count = var.locust_workers >= 1 ? 1 : 0
name = "${local.prefix}-loadtest-master-ci"
location = azurerm_resource_group.deployment.location
resource_group_name = azurerm_resource_group.deployment.name
ip_address_type = "Public"
dns_name_label = "${local.prefix}-loadtest-master"
os_type = "Linux"
restart_policy = "Never" # Locust stops the master once the test is done. A restart_policy other than 'Never' and ACI will restart the container - and the test would run again from start.
container {
name = "${local.prefix}-loadtest-master-ci"
image = var.locust_container_image
cpu = "1"
memory = "1"
commands = [
"locust"
]
environment_variables = merge(local.environment_variables_common, var.locust_headless != true ? local.environment_variables_master : merge(local.environment_variables_master, local.environment_variables_headless))
secure_environment_variables = {
"LOCUST_WEB_AUTH" = "locust:${azurerm_key_vault_secret.locustsecret.value}"
}
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment