Azure Verified Module for Azure Managed DevOps Pool
MIT License
This module deploys and configures Managed DevOps Pools.
This module allows you to deploy Managed DevOps Pools with the following features:
This example deploys a Managed DevOps Pool with private networking.
module "managed_devops_pool" {
source = "Azure/avm-res-devopsinfrastructure-pool/azurerm"
resource_group_name = "my-resource-group"
location = "uksouth"
name = "my-managed-devops-pool"
dev_center_project_resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.DevCenter/Projects/my-project"
version_control_system_organization_name = "my-organization"
version_control_system_project_names = ["my-project"]
subnet_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet"
}
The following requirements are needed by this module:
The following resources are used by this module:
The following input variables are required:
Description: (Required) The resource ID of the Dev Center project.
Type: string
Description: Azure region where the resource should be deployed.
Type: string
Description: Name of the pool. It needs to be globally unique for each Azure DevOps Organization.
Type: string
Description: The resource group where the resources will be deployed.
Type: string
The following input variables are optional (have default values):
Description: How long should the stateful machines be kept around. Maximum value is 7 days and the format must be in d:hh:mm:ss
.
Type: string
Default: null
Description: The kind of agent profile.
Type: string
Default: "Stateless"
Description: The maximum lifetime of the agent. Maximum value is 7 days and the format must be in d:hh:mm:ss
.
Type: string
Default: null
Description: The resource prediction profile for the agent, a.k.a Stand by agent mode
, supported values are 'Off', 'Manual', 'Automatic', defaults to 'Off'.
Type: string
Default: "Off"
Description: The automatic resource prediction profile for the agent.
The object can have the following attributes:
kind
- (Required) The kind of prediction profile. Default is "Automatic".prediction_preference
- (Required) The preference for resource prediction. Supported values are Balanced
, MostCostEffective
, MoreCostEffective
, MorePerformance
, and BestPerformance
.Type:
object({
kind = optional(string, "Automatic")
prediction_preference = optional(string, "Balanced")
})
Default:
{
"kind": "Automatic",
"prediction_preference": "Balanced"
}
Description: The manual resource prediction profile for the agent.
Type:
object({
kind = string
})
Default:
{
"kind": "Manual"
}
Description: An object representing manual resource predictions for agent profiles, including time zone and optional daily schedules.
time_zone
- (Optional) The time zone for the agent profile. E.g. "Eastern Standard Time". Defaults to UTC
. To see valid values for this run this command in PowerShell: [System.TimeZoneInfo]::GetSystemTimeZones() | Select Id, BaseUtcOffSet
days_data
- (Optional) A list representing the manual schedules. Defaults to a single standby agent constantly running.The days_data
list should contain one or seven maps. Supply one to apply the same schedule each day. Supply seven for a different schedule each day.
Examples:
To set always having 1 agent available, you would use the following configuration:
agent_profile_resource_predictions_manual = {
days_data = [
{
"00:00:00" = 1
}
]
}
- To set the schedule for every day to scale to one agent at 8:00 AM and scale down to zero agents at 5:00 PM, you would use the following configuration:
```hcl
agent_profile_resource_predictions_manual = {
time_zone = "Eastern Standard Time"
days_data = [
{
"08:00:00" = 1
"17:00:00" = 0
}
]
}
To set a different schedule for each day, you would use the following configuration:
agent_profile_resource_predictions_manual = {
time_zone = "Eastern Standard Time"
days_data = [
# Sunday
{}, # Empty map to skip Sunday
# Monday
{
"03:00:00" = 2 # Scale to 2 agents at 3:00 AM
"08:00:00" = 4 # Scale to 4 agents at 8:00 AM
"17:00:00" = 2 # Scale to 2 agents at 5:00 PM
"22:00:00" = 0 # Scale to 0 agents at 10:00 PM
},
# Tuesday
{
"08:00:00" = 2
"17:00:00" = 0
},
# Wednesday
{
"08:00:00" = 2
"17:00:00" = 0
},
# Thursday
{
"08:00:00" = 2
"17:00:00" = 0
},
# Friday
{
"08:00:00" = 2
"17:00:00" = 0
},
# Saturday
{} # Empty map to skip Saturday
]
}
Type:
```hcl
object({
time_zone = optional(string, "UTC")
days_data = optional(list(map(number)))
})
Default:
{
"days_data": [
{
"00:00:00": 1
}
]
}
Description: A map of diagnostic settings to create on the Key Vault. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
name
- (Optional) The name of the diagnostic setting. One will be generated if not set, however this will not be unique if you want to create multiple diagnostic setting resources.log_categories
- (Optional) A set of log categories to send to the log analytics workspace. Defaults to []
.log_groups
- (Optional) A set of log groups to send to the log analytics workspace. Defaults to ["allLogs"]
.metric_categories
- (Optional) A set of metric categories to send to the log analytics workspace. Defaults to ["AllMetrics"]
.log_analytics_destination_type
- (Optional) The destination type for the diagnostic setting. Possible values are Dedicated
and AzureDiagnostics
. Defaults to Dedicated
.workspace_resource_id
- (Optional) The resource ID of the log analytics workspace to send logs and metrics to.storage_account_resource_id
- (Optional) The resource ID of the storage account to send logs and metrics to.event_hub_authorization_rule_resource_id
- (Optional) The resource ID of the event hub authorization rule to send logs and metrics to.event_hub_name
- (Optional) The name of the event hub. If none is specified, the default event hub will be selected.marketplace_partner_resource_id
- (Optional) The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic LogsLogs.Type:
map(object({
name = optional(string, null)
log_categories = optional(set(string), [])
log_groups = optional(set(string), ["allLogs"])
metric_categories = optional(set(string), ["AllMetrics"])
log_analytics_destination_type = optional(string, "Dedicated")
workspace_resource_id = optional(string, null)
storage_account_resource_id = optional(string, null)
event_hub_authorization_rule_resource_id = optional(string, null)
event_hub_name = optional(string, null)
marketplace_partner_resource_id = optional(string, null)
}))
Default: {}
Description: This variable controls whether or not telemetry is enabled for the module. For more information see https://aka.ms/avm/telemetryinfo. If it is set to false, then no telemetry will be collected.
Type: bool
Default: true
Description: A list of objects representing the configuration for fabric profile data disks.
caching
- (Optional) The caching setting for the data disk. Valid values are None
, ReadOnly
, and ReadWrite
. Defaults to ReadWrite
.disk_size_gigabytes
- (Optional) The size of the data disk in GiB. Defaults to 100GB.drive_letter
- (Optional) The drive letter for the data disk, If you have any Windows agent images in your pool, choose a drive letter for your disk. If you don't specify a drive letter, F
is used for VM sizes with a temporary disk; otherwise E
is used. The drive letter must be a single letter except A, C, D, or E. If you are using a VM size without a temporary disk and want E
as your drive letter, leave Drive Letter empty to get the default value of E
.storage_account_type
- (Optional) The storage account type for the data disk. Defaults to "Premium_ZRS".Valid values for storage_account_type
are:
Premium_LRS
Premium_ZRS
StandardSSD_LRS
Standard_LRS
Type:
list(object({
caching = optional(string, "ReadWrite")
disk_size_gigabytes = optional(number, 100)
drive_letter = optional(string, null)
storage_account_type = optional(string, "Premium_ZRS")
}))
Default: []
Description: The list of images to use for the fabric profile.
Each object in the list can have the following attributes:
resource_id
- (Optional) The resource ID of the image, this can either be resource ID of a Standard Azure VM Image or a Image that is hosted within Azure Image Gallery.well_known_image_name
- (Optional) The well-known name of the image, thid is used to reference the well-known images that are available on Microsoft Hosted Agents, supported images are ubuntu-22.04/latest
, ubuntu-20.04/latest
, windows-2022/latest
, and windows-2019/latest
.buffer
- (Optional) The buffer associated with the image.aliases
- (Required) A list of aliases for the image.Type:
list(object({
resource_id = optional(string)
well_known_image_name = optional(string)
buffer = optional(string, "*")
aliases = optional(list(string))
}))
Default:
[
{
"aliases": [
"ubuntu-22.04/latest"
],
"well_known_image_name": "ubuntu-22.04/latest"
}
]
Description: The storage account type for the OS disk, possible values are 'Standard', 'Premium' and 'StandardSSD', defaults to 'Premium'.
Type: string
Default: "Premium"
Description: The SKU name of the fabric profile, make sure you have enough quota for the SKU, the CPUs are multiplied by the maximum_concurrency
value, make sure you request enough quota, defaults to 'Standard_D2ads_v5' which has 2 vCPU Cores. so if maximum_concurrency is 2, you will need quota for 4 vCPU Cores and so on.
Type: string
Default: "Standard_D2ads_v5"
Description: Controls the Resource Lock configuration for this resource. The following properties can be specified:
kind
- (Required) The type of lock. Possible values are \"CanNotDelete\"
and \"ReadOnly\"
.name
- (Optional) The name of the lock. If not specified, a name will be generated based on the kind
value. Changing this forces the creation of a new resource.Type:
object({
kind = string
name = optional(string, null)
})
Default: null
Description: Controls the Managed Identity configuration on this resource. The following properties can be specified:
system_assigned
- (Optional) Specifies if the System Assigned Managed Identity should be enabled.user_assigned_resource_ids
- (Optional) Specifies a list of User Assigned Managed Identity resource IDs to be assigned to this resource.Type:
object({
system_assigned = optional(bool, false)
user_assigned_resource_ids = optional(set(string), [])
})
Default: {}
Description: The maximum number of agents that can run concurrently, must be between 1 and 10000, defaults to 1.
Type: number
Default: 1
Description: An object representing the configuration for an organization profile, including organizations and permission profiles.
This is for advanced use cases where you need to specify permissions and multiple organization.
If not suppled, then version_control_system_organization_name
and optionally version_control_system_project_names
must be supplied.
organizations
- (Required) A list of objects representing the organizations.
name
- (Required) The name of the organization, without the https://dev.azure.com/
prefix.projects
- (Optional) A list of project names this agent should run on. If empty, it will run on all projects. Defaults to []
.parallelism
- (Optional) The parallelism value. If multiple organizations are specified, this value needs to be set and cannot exceed the total value of maximum_concurrency
; otherwise, it will use the maximum_concurrency
value as default or the value you define for single Organization.permission_profile
- (Required) An object representing the permission profile.
kind
- (Required) The kind of permission profile, possible values are CreatorOnly
, Inherit
, and SpecificAccounts
, if SpecificAccounts
is chosen, you must provide a list of users and/or groups.users
- (Optional) A list of users for the permission profile, supported value is the ObjectID
or UserPrincipalName
. Defaults to null
.groups
- (Optional) A list of groups for the permission profile, supported value is the ObjectID
of the group. Defaults to null
.Type:
object({
kind = optional(string, "AzureDevOps")
organizations = list(object({
name = string
projects = optional(list(string), []) # List of all Projects names this agent should run on, if empty, it will run on all projects.
parallelism = optional(number) # If multiple organizations are specified, this value needs to be set, otherwise it will use the maximum_concurrency value.
}))
permission_profile = optional(object({
kind = optional(string, "CreatorOnly")
users = optional(list(string), null)
groups = optional(list(string), null)
}), {
kind = "CreatorOnly"
})
})
Default: null
Description: A map of role assignments to create on the . The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
role_definition_id_or_name
- The ID or name of the role definition to assign to the principal.principal_id
- The ID of the principal to assign the role to.description
- (Optional) The description of the role assignment.skip_service_principal_aad_check
- (Optional) If set to true, skips the Azure Active Directory check for the service principal in the tenant. Defaults to false.condition
- (Optional) The condition which will be used to scope the role assignment.condition_version
- (Optional) The version of the condition syntax. Leave as null
if you are not using a condition, if you are then valid values are '2.0'.delegated_managed_identity_resource_id
- (Optional) The delegated Azure Resource Id which contains a Managed Identity. Changing this forces a new resource to be created. This field is only used in cross-tenant scenario.principal_type
- (Optional) The type of the principal_id
. Possible values are User
, Group
and ServicePrincipal
. It is necessary to explicitly set this attribute when creating role assignments if the principal creating the assignment is constrained by ABAC rules that filters on the PrincipalType attribute.Note: only set
skip_service_principal_aad_check
to true if you are assigning a role to a service principal.
Type:
map(object({
role_definition_id_or_name = string
principal_id = string
description = optional(string, null)
skip_service_principal_aad_check = optional(bool, false)
condition = optional(string, null)
condition_version = optional(string, null)
delegated_managed_identity_resource_id = optional(string, null)
principal_type = optional(string, null)
}))
Default: {}
Description: The virtual network subnet resource id to use for private networking.
Type: string
Default: null
Description: The subscription ID to use for the resource. Only required if you want to target a different subscription the the current context.
Type: string
Default: null
Description: (Optional) Tags of the resource.
Type: map(string)
Default: null
Description: The name of the version control system organization. This is required if organization_profile
is not supplied.
Type: string
Default: null
Description: The name of the version control system project. This is optional if organization_profile
is not supplied.
Type: set(string)
Default: []
Description: The type of version control system. This is shortcut alternative to organization_profile.kind
. Possible values are 'azuredevops' or 'github'.
Type: string
Default: "azuredevops"
The following outputs are exported:
Description: The name of the Managed DevOps Pool.
Description: This is the full output for the Managed DevOps Pool.
Description: The resource if of the Managed DevOps Pool.
No modules.
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.