101-devtest-labs - generate the vm name with random value (#272)
* 101-devtest-labs - update the vm name
This commit is contained in:
parent
d136bbb5a1
commit
6e5cdfc2a6
@ -2,6 +2,13 @@ resource "random_pet" "rg_name" {
|
||||
prefix = var.resource_group_name_prefix
|
||||
}
|
||||
|
||||
resource "random_string" "vm_suffix" {
|
||||
length = 5
|
||||
upper = false
|
||||
special = false
|
||||
numeric = false
|
||||
}
|
||||
|
||||
resource "azurerm_resource_group" "rg" {
|
||||
name = random_pet.rg_name.id
|
||||
location = var.resource_group_location
|
||||
@ -34,7 +41,7 @@ resource "azurerm_dev_test_virtual_network" "vnet" {
|
||||
}
|
||||
|
||||
resource "azurerm_dev_test_windows_virtual_machine" "vm" {
|
||||
name = var.vm_name
|
||||
name = "ExampleVM-${random_string.vm_suffix.result}"
|
||||
lab_name = azurerm_dev_test_lab.lab.name
|
||||
lab_subnet_name = "Dtl${var.lab_name}Subnet"
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
|
@ -17,7 +17,6 @@ This template deploys a Windows virtual machine within an Azure DevTest Lab.
|
||||
| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg |
|
||||
| `resource_group_location` | Location of the resource group. | eastus |
|
||||
| `lab_name` | The name of the new lab instance to be created. | |
|
||||
| `vm_name` | The name of the VM to be created. | |
|
||||
| `vm_size` | The size of the VM to be created. | Standard_D4_v3 |
|
||||
| `user_name` | The username for the local account that will be created on the new VM. | |
|
||||
| `password` | The password for the local account that will be created on the new VM. | |
|
||||
|
@ -16,12 +16,6 @@ variable "lab_name" {
|
||||
default = "ExampleLab"
|
||||
}
|
||||
|
||||
variable "vm_name" {
|
||||
type = string
|
||||
description = "The name of the vm to be created."
|
||||
default = "example-vm"
|
||||
}
|
||||
|
||||
variable "vm_size" {
|
||||
type = string
|
||||
description = "The size of the vm to be created."
|
||||
|
Loading…
x
Reference in New Issue
Block a user