This template shows how to use Terraform to deploy a pool of agent VMs on which a subsequent job is run.
The Terraform definition does not contain any other resources. You can extend the definition with your custom infrastructure, such as Web Apps.
The template deploys agents at a high density, with (by default) 2 agent VMs with 4 Azure DevOps build agents per VM. This is efficient when running pipelines that do not require much local computing power, or only sporadically.
In your Azure DevOps project settings, create an Agent pool.
Name the pool starterpool
(if you want to use a different name, change the value in azure-pipelines.yml).
In Azure DevOps, create a PAT token. Click on Show all scopes and grant the token Read and Manage permissions on Agent Pools.
Under Library, create a Variable Group named terraform-secrets
. Create a secret
named AGENT_POOL_MANAGE_PAT_TOKEN
and paste the token value.
Make the variable secret using the padlock icon.
To use the template, follow the section How to use the templates in the main README file.
The pipeline configures the agent VMs to automatically shutdown daily at 23:00 UTC.
To use a different schedule, change TF_VAR_az_devops_agent_vm_shutdown_time
in azure-pipelines.yml,
or remove that line completely to disable automatic shutdown.
The pipeline contains a task to start up the agent VMs again before running the agent job.