Edits per Code Review
This commit is contained in:
parent
d57838d056
commit
d8e9d4b7ae
@ -1 +0,0 @@
|
||||
Article not yet tested by automated testing pipeline.
|
@ -7,6 +7,20 @@ resource "azurerm_resource_group" "rg" {
|
||||
location = var.resource_group_location
|
||||
}
|
||||
|
||||
resource "random_password" "password" {
|
||||
count = var.password == null ? 1 : 0
|
||||
length = 20
|
||||
special = true
|
||||
min_numeric = 1
|
||||
min_upper = 1
|
||||
min_lower = 1
|
||||
min_special = 1
|
||||
}
|
||||
|
||||
locals {
|
||||
password = try(random_password.password[0].result, var.password)
|
||||
}
|
||||
|
||||
resource "azurerm_dev_test_lab" "lab" {
|
||||
name = var.lab_name
|
||||
location = azurerm_resource_group.rg.location
|
||||
@ -20,17 +34,17 @@ resource "azurerm_dev_test_virtual_network" "vnet" {
|
||||
}
|
||||
|
||||
resource "azurerm_dev_test_windows_virtual_machine" "vm" {
|
||||
name = var.vm_name
|
||||
lab_name = azurerm_dev_test_lab.lab.name
|
||||
lab_subnet_name = "Dtl${var.lab_name}Subnet"
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
location = azurerm_resource_group.rg.location
|
||||
storage_type = "Standard"
|
||||
size = var.vm_size
|
||||
username = var.user_name
|
||||
password = var.password
|
||||
allow_claim = false
|
||||
lab_virtual_network_id = azurerm_dev_test_virtual_network.vnet.id
|
||||
name = var.vm_name
|
||||
lab_name = azurerm_dev_test_lab.lab.name
|
||||
lab_subnet_name = "Dtl${var.lab_name}Subnet"
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
location = azurerm_resource_group.rg.location
|
||||
storage_type = "Standard"
|
||||
size = var.vm_size
|
||||
username = var.user_name
|
||||
password = local.password
|
||||
allow_claim = false
|
||||
lab_virtual_network_id = azurerm_dev_test_virtual_network.vnet.id
|
||||
|
||||
gallery_image_reference {
|
||||
offer = "WindowsServer"
|
||||
|
@ -1,3 +1,8 @@
|
||||
output "lab_id" {
|
||||
value = azurerm_dev_test_lab.lab.id
|
||||
}
|
||||
|
||||
output "password" {
|
||||
sensitive = true
|
||||
value = local.password
|
||||
}
|
||||
|
@ -27,4 +27,5 @@ variable "user_name" {
|
||||
|
||||
variable "password" {
|
||||
description = "The password for the local account that will be created on the new vm."
|
||||
sensitive = true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user