In Azure, you can create Self Hosted Linux Build agent using release pipeline (Terraform template) and override template parameter values using variables.
Terraform
Create an Azure linux VM using Terraform in Azure Devops using Release Pipelines
Terraform allows you to define and create complete infrastructure deployments in Azure. You build Terraform templates in a human-readable format that create and configure Azure resources in a consistent, reproducible manner.
Some of the Terraform – Azure script errors and solutions
Some of the errors you receive while creating infrastructure in Azure using Terraform