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
|
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" {
|
resource "azurerm_dev_test_lab" "lab" {
|
||||||
name = var.lab_name
|
name = var.lab_name
|
||||||
location = azurerm_resource_group.rg.location
|
location = azurerm_resource_group.rg.location
|
||||||
@ -28,7 +42,7 @@ resource "azurerm_dev_test_windows_virtual_machine" "vm" {
|
|||||||
storage_type = "Standard"
|
storage_type = "Standard"
|
||||||
size = var.vm_size
|
size = var.vm_size
|
||||||
username = var.user_name
|
username = var.user_name
|
||||||
password = var.password
|
password = local.password
|
||||||
allow_claim = false
|
allow_claim = false
|
||||||
lab_virtual_network_id = azurerm_dev_test_virtual_network.vnet.id
|
lab_virtual_network_id = azurerm_dev_test_virtual_network.vnet.id
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
output "lab_id" {
|
output "lab_id" {
|
||||||
value = azurerm_dev_test_lab.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" {
|
variable "password" {
|
||||||
description = "The password for the local account that will be created on the new vm."
|
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