refactor code

This commit is contained in:
Jen Sheerin
2022-03-25 14:54:22 -04:00
parent 64aa77f9f8
commit d0af975d18
12 changed files with 139 additions and 61 deletions

View File

@ -1,7 +1,11 @@
# Create AVD Resource Group
# 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 = var.rg_name
location = var.deploy_location
name = random_pet.rg-name.id
location = var.resource_group_location
}
# Create AVD workspace
@ -13,10 +17,6 @@ resource "azurerm_virtual_desktop_workspace" "workspace" {
description = "${var.prefix} Workspace"
}
resource "time_rotating" "avd_token" {
rotation_days = 30
}
# Create AVD host pool
resource "azurerm_virtual_desktop_host_pool" "hostpool" {
resource_group_name = azurerm_resource_group.rg.name
@ -30,9 +30,14 @@ resource "azurerm_virtual_desktop_host_pool" "hostpool" {
maximum_sessions_allowed = 16
load_balancer_type = "DepthFirst" #[BreadthFirst DepthFirst]
registration_info {
expiration_date = time_rotating.avd_token.rotation_rfc3339
}
# 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
}
# Create AVD DAG