Skip to content

data-platform-hq/terraform-azurerm-windows-vm

Repository files navigation

Azure Windows vm Terraform module

Terraform module for creation Azure Windows vm

Usage

# Prerequisite resources

data "azurerm_resource_group" "example" {
  name                = "example"
}

data "azurerm_subnet" "example" {
  name                 = "example"
  virtual_network_name = "production"
  resource_group_name  = data.azurerm_resource_group.example.name
}

resource "random_password" "example" {
  length           = 10
  special          = true
  override_special = "_!@#$%&*()-+="
}

module "windows_virtual_machine" {
  source   = "data-platform-hq/windows-vm/azurerm"
  version  = "~> 1.0"

  project        = var.project
  env            = var.env
  resource_group = data.azurerm_resource_group.example.name
  location       = var.location
  subnet_id      = data.azurerm_subnet.example.id
  
  vm_admin_username = "testusername"
  vm_admin_password = random_password.example.result
}

Requirements

Name Version
terraform >=1.0.0
azurerm >= 4.0.1

Providers

Name Version
azurerm >= 4.0.1

Modules

No modules.

Resources

Name Type
azurerm_network_interface.this resource
azurerm_public_ip.this resource
azurerm_windows_virtual_machine.this resource

Inputs

Name Description Type Default Required
custom_network_interface_name Specifies the name of the virtual machine interface name resource string null no
custom_public_ip_name Specifies the name of the public ip name name resource string null no
custom_virtual_machine_name Specifies the name of the virtual machine name resource string "" no
env Environment name string n/a yes
identity_enabled Boolean flag than enables creation of System Assigned identity to VM bool false no
location Azure location string n/a yes
network_interface_private_ip_address_allocation The allocation method used for the Private IP Address. string "Dynamic" no
os_disk Objects to configure os disk reference for virtual machine
object({
caching = string
storage_account_type = string
})
{
"caching": "ReadWrite",
"storage_account_type": "Standard_LRS"
}
no
project Project name string n/a yes
public_ip_allocation_method Defines the allocation method for this IP address. Possible values are Static or Dynamic string "Static" no
public_ip_enabled Boolean flag to enable Public Ip address creation and assignment to Virtual Machine bool false no
resource_group The name of the resource group string n/a yes
source_image_reference Objects to configure source image reference for virtual machine
object({
publisher = string
offer = string
sku = string
version = string
})
{
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2022-datacenter-azure-edition",
"version": "latest"
}
no
subnet_id The ID of the Subnet where this Network Interface should be located in. string n/a yes
suffix Optional suffix that would be added to the end of resources names. It is recommended to use dash at the beginning of variable (e.x., '-example') string "" no
tags Resource tags map(any) {} no
vm_admin_password The password of the local administrator used for the Virtual Machine. string n/a yes
vm_admin_username The username of the local administrator used for the Virtual Machine. string "adminuser" no
vm_size The SKU which should be used for this Virtual Machine. string "Standard_D2s_v5" no

Outputs

Name Description
id The ID of the Windows Virtual Machine
identity Windows virtual machine Identities list
private_ip Windows Virtual Machine private IP address
public_ip Windows Virtual Machine public IP address

License

Apache 2 Licensed. For more information please see LICENSE