tonyskidmore / terraform-azurerm-vmss

Terraform azurerm Virtual Machine Scale Set module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-azurevm-vmss

GitHub Super-Linter

Azure Virtual Machine Scale Set Terraform module. It forms the starting point for the creation of a Windows or Linux Azure virtual machine scale set agent pool in Azure DevOps.

This module is used by the terraform-azurerm-vmss-devops-agent to create the Azure VMSS side of a self-hosted Azure DevOps Scale Set agent pool.

Basic example

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "vmss" {
  name     = var.vmss_resource_group_name
  location = var.vmss_location
}

resource "azurerm_virtual_network" "vmss" {
  name                = var.vmss_vnet_name
  resource_group_name = azurerm_resource_group.vmss.name
  address_space       = var.vmss_vnet_address_space
  location            = azurerm_resource_group.vmss.location
  tags                = var.tags
}

resource "azurerm_subnet" "agents" {
  name                 = var.vmss_subnet_name
  resource_group_name  = azurerm_resource_group.vmss.name
  address_prefixes     = var.vmss_subnet_address_prefixes
  virtual_network_name = azurerm_virtual_network.vmss.name
}

module "vmss" {
  source                   = "tonyskidmore/vmss/azurerm"
  version                  = "0.4.0"
  vmss_name                = var.vmss_name
  vmss_resource_group_name = var.vmss_resource_group_name
  vmss_subnet_id           = azurerm_subnet.agents.id
  vmss_admin_password      = var.vmss_admin_password
}

Resources

Name Type
azurerm_linux_virtual_machine_scale_set.ado_pool resource
azurerm_windows_virtual_machine_scale_set.ado_pool resource

Inputs

Name Description Type Default Required
tags Tags to apply to Azure Virtual Machine Scale map(string) {} no
vmss_admin_password Azure Virtual Machine Scale Set instance administrator password string null no
vmss_admin_username Azure Virtual Machine Scale Set instance administrator name string "adminuser" no
vmss_auto_upgrade_minor_version Specifies whether or not to use the latest minor version available string true no
vmss_computer_name_prefix The prefix which should be used for the name of the Virtual Machines in this Scale Set string null no
vmss_custom_data The base64 encoded data to use as custom data for the VMSS instances string null no
vmss_data_disks Additional data disks
list(object({
caching = string
create_option = string
disk_size_gb = string
lun = number
storage_account_type = string
}))
[] no
vmss_disk_size_gb The Size of the Internal OS Disk in GB, if you wish to vary from the size used in the image this Virtual Machine Scale Set is sourced from number null no
vmss_enable_automatic_updates Are automatic updates enabled for this Virtual Machine? (Windows) string null no
vmss_encryption_at_host_enabled Should all of the disks (including the temp disk) attached to this Virtual Machine be encrypted by enabling Encryption at Host? bool false no
vmss_identity_ids Specifies a list of User Assigned Managed Identity IDs to be assigned to this Linux Virtual Machine Scale Set list(string) null no
vmss_identity_type Specifies the type of Managed Service Identity that should be configured on this Linux Virtual Machine Scale Set string null no
vmss_instances Azure Virtual Machine Scale Set number of instances number 0 no
vmss_load_balancer_backend_address_pool_ids A list of Backend Address Pools IDs from a Load Balancer which this Virtual Machine Scale Set should be connected to list(string) null no
vmss_location Existing resource group name of where the VMSS will be created string "uksouth" no
vmss_name Azure Virtual Machine Scale Set name string "azdo-vmss-pool-001" no
vmss_os Whether to process the Linux Virtual Machine Scale Set resource string "linux" no
vmss_os_disk_caching The Type of Caching which should be used for the Internal OS Disk string "ReadOnly" no
vmss_os_disk_storage_account_type The Type of Storage Account which should back this the Internal OS Disk string "StandardSSD_LRS" no
vmss_resource_group_name Existing resource group name of where the VMSS will be created string n/a yes
vmss_resource_prefix Prefix to apply to VMSS resources string "vmss" no
vmss_se_enabled Whether to process the Linux Virtual Machine Scale Set extension resource bool false no
vmss_se_settings_data The base64 encoded data to use as the script for the VMSS custom script extension string null no
vmss_se_settings_script The path of the file to use as the script for the VMSS custom script extension string "scripts/vmss-startup.sh" no
vmss_sku Azure Virtual Machine Scale Set SKU string "Standard_D2s_v3" no
vmss_source_image_id Azure Virtual Machine Scale Set Image ID string null no
vmss_source_image_offer Azure Virtual Machine Scale Set Source Image Offer string null no
vmss_source_image_publisher Azure Virtual Machine Scale Set Source Image Publisher string null no
vmss_source_image_sku Azure Virtual Machine Scale Set Source Image SKU string null no
vmss_source_image_version Azure Virtual Machine Scale Set Source Image Version string null no
vmss_ssh_public_key Public key to use for SSH access to VMs string "" no
vmss_storage_account_uri VMSS boot diagnostics storage account URI string null no
vmss_subnet_id Existing subnet ID of where the VMSS will be connected string n/a yes
vmss_user_data The base64 encoded data to use as user data for the VMSS instances string null no
vmss_win_se_settings The value to pass to the Windows VMSS custom script extension string null no
vmss_win_se_settings_data The base64 encoded data to use as the script for the Windows VMSS custom script extension string "scripts/Set-VmssConfig.ps1" no
vmss_win_se_settings_script The path of the file to use as the caller script for the Windows VMSS custom script extension string "scripts/Start-VmssConfig.ps1" no
vmss_zones A collection of availability zones to spread the Virtual Machines over list(string) [] no

Outputs

Name Description
vmss Virtual Machine Scale Set object
vmss_id Virtual Machine Scale Set ID
vmss_system_assigned_identity_id Virtual Machine Scale Set SystemAssigned Identity
vmss_user_assigned_identity_ids Virtual Machine Scale Set UserAssigned Identities

Providers

Name Version
azurerm >=3.1.0, <4.0.0

Troubleshooting

Linux

Use the Serial console in the portal or via the Azure CLI to help troubleshoot deployment issues:

# Press enter to get a login
vmss-agent-pool-linux-003000000 login: adminuser
Password:

Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1052-azure x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sat Dec  2 13:18:05 UTC 2023

  System load:  0.04              Processes:             122
  Usage of /:   7.5% of 28.89GB   Users logged in:       0
  Memory usage: 5%                IPv4 address for eth0: 192.168.0.4
  Swap usage:   0%

Expanded Security Maintenance for Applications is not enabled.

2 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status



The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Windows

Use the Serial console in the portal or via the Azure CLI to help troubleshoot deployment issues:

# specify the VMSS name (-n), Resource group (-g) and instance number (e.g. 0)
az serial-console connect -n vmss-win-ado-001 -g rg-vmss-win-001 --instance-id 0
cmd
ch
ch -si 1

Please enter login credentials.
?Username: ?adminuser
Domain  : ?
Password: ?********************

About

Terraform azurerm Virtual Machine Scale Set module

License:MIT License


Languages

Language:HCL 77.4%Language:PowerShell 18.0%Language:Shell 4.6%