New sample (converted from Bicep via OpenAI)
This commit is contained in:
parent
c2a3a784d8
commit
deeba27652
41
quickstart/101-devtest-labs/main.tf
Normal file
41
quickstart/101-devtest-labs/main.tf
Normal file
@ -0,0 +1,41 @@
|
||||
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_dev_test_lab" "lab" {
|
||||
name = var.lab_name
|
||||
location = azurerm_resource_group.rg.location
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
}
|
||||
|
||||
resource "azurerm_dev_test_virtual_network" "vnet" {
|
||||
name = "Dtl${var.lab_name}"
|
||||
lab_name = azurerm_dev_test_lab.lab.name
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
gallery_image_reference {
|
||||
offer = "WindowsServer"
|
||||
publisher = "MicrosoftWindowsServer"
|
||||
sku = "2019-Datacenter"
|
||||
version = "latest"
|
||||
}
|
||||
}
|
3
quickstart/101-devtest-labs/outputs.tf
Normal file
3
quickstart/101-devtest-labs/outputs.tf
Normal file
@ -0,0 +1,3 @@
|
||||
output "lab_id" {
|
||||
value = azurerm_dev_test_lab.lab.id
|
||||
}
|
16
quickstart/101-devtest-labs/providers.tf
Normal file
16
quickstart/101-devtest-labs/providers.tf
Normal file
@ -0,0 +1,16 @@
|
||||
terraform {
|
||||
required_version = ">=0.12"
|
||||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = "~>2.0"
|
||||
}
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
version = "~>3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
21
quickstart/101-devtest-labs/readme.md
Normal file
21
quickstart/101-devtest-labs/readme.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Windows virtual machine in an Azure DevTest Lab
|
||||
|
||||
This template deploys a Windows virtual machine within an Azure DevTest Lab.
|
||||
|
||||
## Terraform resource types
|
||||
|
||||
- [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet)
|
||||
- [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group)
|
||||
- [azurerm_dev_test_lab](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dev_test_lab)
|
||||
- [azurerm_dev_test_virtual_network](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dev_test_virtual_network)
|
||||
- [azurerm_dev_test_windows_virtual_machine](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dev_test_windows_virtual_machine)
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Description | Default |
|
||||
|-|-|-|
|
||||
| `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. | |
|
30
quickstart/101-devtest-labs/variables.tf
Normal file
30
quickstart/101-devtest-labs/variables.tf
Normal file
@ -0,0 +1,30 @@
|
||||
variable "resource_group_location" {
|
||||
default = "eastus"
|
||||
description = "Location for all resources."
|
||||
}
|
||||
|
||||
variable "resource_group_name_prefix" {
|
||||
default = "rg"
|
||||
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
|
||||
}
|
||||
|
||||
variable "lab_name" {
|
||||
description = "The name of the new lab instance to be created"
|
||||
}
|
||||
|
||||
variable "vm_name" {
|
||||
description = "The name of the vm to be created."
|
||||
}
|
||||
|
||||
variable "vm_size" {
|
||||
description = "The size of the vm to be created."
|
||||
default = "Standard_D4_v3"
|
||||
}
|
||||
|
||||
variable "user_name" {
|
||||
description = "The username for the local account that will be created on the new vm."
|
||||
}
|
||||
|
||||
variable "password" {
|
||||
description = "The password for the local account that will be created on the new vm."
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user