Terraform module to deploy an Azure Virtual Desktop.
Module version | Terraform version | OpenTofu version | AzureRM version |
---|---|---|---|
>= 8.x.x | Unverified | 1.8.x | >= 4.0 |
>= 7.x.x | 1.3.x | >= 3.0 | |
>= 6.x.x | 1.x | >= 3.0 | |
>= 5.x.x | 0.15.x | >= 2.0 | |
>= 4.x.x | 0.13.x / 0.14.x | >= 2.0 | |
>= 3.x.x | 0.12.x | >= 2.0 | |
>= 2.x.x | 0.12.x | < 2.0 | |
< 2.x.x | 0.11.x | < 2.0 |
If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.
More details are available in the CONTRIBUTING.md file.
This module is optimized to work with the Claranet terraform-wrapper tool
which set some terraform variables in the environment needed by this module.
More details about variables set by the terraform-wrapper
available in the documentation.
locals {
timezone = "Romance Standard Time"
# Entra ID
avd_group_display_name = "AVD Users"
avd_user_01_object_id = "axxxxxxx-axxx-axxx-axxx-axxxxxxxxxxx"
avd_user_02_object_id = "bxxxxxxx-bxxx-bxxx-bxxx-bxxxxxxxxxxx"
}
data "azuread_group" "avd_group" {
display_name = local.avd_group_display_name
security_enabled = true
}
module "avd" {
source = "claranet/avd/azurerm"
version = "x.x.x"
location = module.azure_region.location
location_short = module.azure_region.location_short
client_name = var.client_name
environment = var.environment
stack = var.stack
resource_group_name = module.rg.name
workspace_config = {
extra_tags = {
foo = "bar"
}
}
host_pool_config = {
load_balancer_type = "DepthFirst" # Value will automatically change depending on the Scaling Plan settings
maximum_sessions_allowed = 24
scheduled_agent_updates = {
enabled = true
timezone = local.timezone
schedules = [
{
day_of_week = "Sunday"
hour_of_day = 8
},
{
day_of_week = "Wednesday"
hour_of_day = 22
},
]
}
}
application_group_config = {
role_assignments_object_ids = concat(
data.azuread_group.avd_group.members,
[
local.avd_user_01_object_id,
local.avd_user_02_object_id,
],
)
}
applications_config = {
app-1 = {
path = "C:\\application\\app-1.exe"
}
}
scaling_plan_config = {
enabled = true
timezone = local.timezone
schedules = [
{
name = "weekdays"
days_of_week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
ramp_up_start_time = "08:00"
peak_start_time = "09:00"
ramp_down_start_time = "19:00"
off_peak_start_time = "22:00"
},
{
name = "weekend"
days_of_week = ["Saturday", "Sunday"]
ramp_up_start_time = "09:00"
peak_start_time = "10:00"
ramp_down_start_time = "17:00"
off_peak_start_time = "20:00"
},
]
# role_assignment = {
# enabled = false # `false` if you do not have permission to create the Role and the Role Assignment, but this must be done somehow
# object_id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee" # In case you do not have permsision to retrieve the object ID of the AVD Service Principal
# }
}
logs_destinations_ids = [
module.run.logs_storage_account_id,
module.run.log_analytics_workspace_id,
]
extra_tags = {
purpose = "demo"
}
}
Name | Version |
---|---|
azuread | ~> 3.0 |
azurecaf | ~> 1.2.28 |
azurerm | ~> 4.0 |
time | ~> 0.12 |
Name | Source | Version |
---|---|---|
diagnostics_app_group | claranet/diagnostic-settings/azurerm | ~> 8.0.0 |
diagnostics_host_pool | claranet/diagnostic-settings/azurerm | ~> 8.0.0 |
diagnostics_scaling_plan | claranet/diagnostic-settings/azurerm | ~> 8.0.0 |
diagnostics_workspace | claranet/diagnostic-settings/azurerm | ~> 8.0.0 |
Name | Type |
---|---|
azurerm_role_assignment.app_group_role_assignments | resource |
azurerm_role_assignment.scaling_role_assignment | resource |
azurerm_role_definition.scaling_role_definition | resource |
azurerm_virtual_desktop_application.main | resource |
azurerm_virtual_desktop_application_group.main | resource |
azurerm_virtual_desktop_host_pool.main | resource |
azurerm_virtual_desktop_host_pool_registration_info.main | resource |
azurerm_virtual_desktop_scaling_plan.main | resource |
azurerm_virtual_desktop_workspace.main | resource |
azurerm_virtual_desktop_workspace_application_group_association.main | resource |
time_rotating.time | resource |
azuread_application_published_app_ids.well_known | data source |
azuread_service_principal.avd_service_principal | data source |
azurecaf_name.avd_app | data source |
azurecaf_name.avd_app_group | data source |
azurecaf_name.avd_host_pool | data source |
azurecaf_name.avd_scaling_plan | data source |
azurecaf_name.avd_workspace | data source |
azurerm_client_config.current | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
application_group_config | AVD Application Group specific configuration. | object({ |
{} |
no |
application_group_custom_name | Custom Azure Virtual Desktop Application Group name, generated if not set. | string |
"" |
no |
applications_config | AVD applications configuration. Description of parameters here. | map(object({ |
{} |
no |
client_name | Client name/account used in naming. | string |
n/a | yes |
default_tags_enabled | Option to enable or disable default tags. | bool |
true |
no |
diagnostic_settings_custom_name | Custom name of the diagnostics settings, name will be default if not set. |
string |
"default" |
no |
environment | Project environment. | string |
n/a | yes |
extra_tags | Additional tags to add on resources. | map(string) |
{} |
no |
host_pool_config | AVD Host Pool specific configuration. | object({ |
{} |
no |
host_pool_custom_name | Custom Azure Virtual Desktop host pool name, generated if not set. | string |
"" |
no |
location | Azure region to use. | string |
n/a | yes |
location_short | Short string for Azure location. | string |
n/a | yes |
logs_categories | Log categories to send to destinations. | list(string) |
null |
no |
logs_destinations_ids | List of destination resources IDs for logs diagnostic destination. Can be Storage Account , Log Analytics Workspace and Event Hub . No more than one of each can be set.If you want to use Azure EventHub as a destination, you must provide a formatted string containing both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the | character. |
list(string) |
n/a | yes |
logs_metrics_categories | Metrics categories to send to destinations. | list(string) |
null |
no |
name_prefix | Optional prefix for the generated name. | string |
"" |
no |
name_suffix | Optional suffix for the generated name. | string |
"" |
no |
resource_group_name | Name of the resource group. | string |
n/a | yes |
scaling_plan_config | AVD Scaling Plan specific configuration. | object({ |
{} |
no |
scaling_plan_custom_name | Custom Azure Virtual Desktop Scaling Plan name, generated if not set. | string |
"" |
no |
stack | Project stack name. | string |
n/a | yes |
workspace_config | AVD Workspace specific configuration. | object({ |
{} |
no |
workspace_custom_name | Custom Azure Virtual Desktop workspace name, generated if not set. | string |
"" |
no |
Name | Description |
---|---|
application_group_id | AVD Application Group ID. |
application_group_name | AVD Application Group name. |
avd_service_principal_client_id | AVD Service Principal Client ID (Application ID). |
avd_service_principal_name | AVD Service Principal name. |
avd_service_principal_object_id | AVD Service Principal Object ID (Principal ID). |
host_pool_id | AVD Host Pool ID. |
host_pool_name | AVD Host Pool name. |
host_registration_token | AVD host registration token. |
host_registration_token_expiration_date | AVD host registration token expiration date. |
resouce_application | AVD Application resource object. |
resource_application_group | AVD Application Group resource object. |
resource_host_pool | AVD Host Pool resource object. |
resource_scaling_plan | AVD Scaling Plan resource object. |
resource_workspace | AVD Workspace resource object. |
scaling_plan_id | AVD Scaling Plan ID. |
scaling_plan_name | AVD Scaling Plan name. |
scaling_plan_role_definition | AVD Scaling Plan Role Definition resource object. |
scaling_plan_role_definition_id | AVD Scaling Plan Role Definition ID. |
scaling_plan_role_definition_name | AVD Scaling Plan Role Definition name. |
workspace_id | AVD Workspace ID. |
workspace_name | AVD Workspace name. |