This commit is contained in:
Jen Sheerin
2022-03-28 22:05:53 -04:00
parent b562c8a2fc
commit a2399f96b5
8 changed files with 96 additions and 63 deletions

View File

@ -1,26 +1,22 @@
# Randomization of resource group name.
# Resource group name is output when execution plan is applied.
resource "random_pet" "rg-name" {
prefix = var.resource_group_name_prefix
}
resource "azurerm_resource_group" "rg" {
name = random_pet.rg-name.id
location = var.resource_group_location
resource "azurerm_resource_group" "sh" {
name = var.rg_name
location = var.resource_group_location
}
# Create AVD workspace
resource "azurerm_virtual_desktop_workspace" "workspace" {
name = var.workspace
resource_group_name = azurerm_resource_group.rg.name
location = var.deploy_location
resource_group_name = azurerm_resource_group.sh.name
location = azurerm_resource_group.sh.location
friendly_name = "${var.prefix} Workspace"
description = "${var.prefix} Workspace"
}
# Create AVD host pool
resource "azurerm_virtual_desktop_host_pool" "hostpool" {
resource_group_name = azurerm_resource_group.rg.name
location = var.deploy_location
resource_group_name = azurerm_resource_group.sh.name
location = azurerm_resource_group.sh.location
name = var.hostpool
friendly_name = var.hostpool
validate_environment = true
@ -29,22 +25,18 @@ resource "azurerm_virtual_desktop_host_pool" "hostpool" {
type = "Pooled"
maximum_sessions_allowed = 16
load_balancer_type = "DepthFirst" #[BreadthFirst DepthFirst]
# Create registration info
resource "time_rotating" "avd_token" {
rotation_days = 30
}
resource "azurerm_virtual_desktop_host_pool_registration_info" "registrationinfo" {
hostpool_id = azurerm_virtual_desktop_host_pool.hostpool.id
expiration_date = time_rotating.avd_token.rfc3339
expiration_date = var.rfc3339
}
# Create AVD DAG
resource "azurerm_virtual_desktop_application_group" "dag" {
resource_group_name = azurerm_resource_group.rg.name
resource_group_name = azurerm_resource_group.sh.name
host_pool_id = azurerm_virtual_desktop_host_pool.hostpool.id
location = var.deploy_location
location = azurerm_resource_group.sh.location
type = "Desktop"
name = "${var.prefix}-dag"
friendly_name = "Desktop AppGroup"