Skip to content

data-platform-hq/terraform-azurerm-vmss

Repository files navigation

Azure VMSS Terraform module

Terraform module for creation Azure Virtual Machine Scale Sets

Usage

resource "tls_private_key" "scale_set" {
  algorithm = "RSA"
  rsa_bits  = 2048
}

data "azurerm_subnet" "example" {
  name                 = "example-name"
  virtual_network_name = "example-vn-name"
  resource_group_name  = "example-rg"
}

module "vm_scale_sets" {
  source   = "data-platform-hq/vmss/azurerm"
  version  = "1.0.0"
  
  project        = "datahq"
  env            = "example"
  location       = "eastus"
  resource_group = "example-rg"
  admin_ssh_key  = { public_key = tls_private_key.scale_set[0].public_key_openssh }
  subnet         = data.azurerm_subnet.example.id
 }

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_linux_virtual_machine_scale_set.this resource
azurerm_monitor_data_collection_rule.this resource
azurerm_monitor_data_collection_rule_association.this resource
azurerm_public_ip_prefix.this resource

Inputs

Name Description Type Default Required
admin_ssh_key Objects to configure ssh key reference for Virtual Machine Scale Sets
object({
username = optional(string, "azureuser")
public_key = string
})
{
"public_key": null,
"username": null
}
no
analytics_workspace_id Resource ID of Log Analytics Workspace string null no
automatic_os_upgrade_policy Configuration options for automatic os upgrade policy
object({
disable_automatic_rollback = optional(bool, false)
enable_automatic_os_upgrade = optional(bool, false)
})
{} no
automatic_os_upgrade_policy_enabled Boolean flag that determines whether automatic os upgrade policy is enabled bool false no
data_collection_rule_association_name Data collection rule association name string null no
data_collection_rule_name Data collection rule name string null no
datasource_name Datasource syslog name string "datasource-syslog" no
dcr_association_description Description of Data collection rule association string "Association between the Data Collection Rule and the Linux VM." no
dependency_agent_extension_version Version of VMSS extension required for logging string "9.5" no
enable_data_collection_rule Enable data collection rule. var.analytics_workspace_id must be provided bool false no
enable_data_collection_rule_association Enable data collection rule association. var.analytics_workspace_id must be provided bool true no
enable_scale_set_extension Enable scale set extension. var.analytics_workspace_id must be provided bool true no
extensions Virtual Machine scale set extensions config
set(object({
name = string
publisher = string
type = string
type_handler_version = string
settings = optional(string)
protected_settings = optional(string)
}))
[] no
facility_names List of Facility names list(string)
[
"daemon",
"syslog",
"user"
]
no
identity_ids List of user assigned identity IDs list(string) null no
location The Azure Region in which all resources in this example should be created. string n/a yes
log_levels List of Log levels list(string)
[
"Debug"
]
no
os_disk Objects to configure os disk reference for Virtual Machine Scale Sets
object({
caching = optional(string, "ReadWrite")
storage_account_type = optional(string, "Standard_LRS")
})
{} no
public_ip_prefix_enabled Boolean flag that determines whether Public IP Address prefix is created for VM Scale Set. bool true no
public_ip_prefix_length Public IP Address prefix length. Possible value are between 0 and 31. string 30 no
public_ip_prefix_name Public IP Address prefix name. string null no
resource_group The name of the resource group. string n/a yes
scale_set_configuration Configuration options for linux virtual machine scale set
object({
sku = optional(string, "Standard_D2_v2")
instances = optional(string, "2")
admin_username = optional(string, "azureuser")
admin_password = optional(string, null)
disable_password_authentication = optional(bool, true)
priority = optional(string, "Regular")
overprovision = optional(bool, false)
single_placement_group = optional(bool, false)
upgrade_mode = optional(string, "Manual")
enable_ip_forwarding_interface = optional(bool, false)
domain_name_label = optional(string, null)
lb_backend_address_pool_ids = optional(list(string), [])
})
{} no
scale_set_name Virtual Machine Scale Set name. string n/a yes
source_image_reference Objects to configure source image reference for Virtual Machine Scale Sets
object({
publisher = string
offer = string
sku = string
version = string
})
{
"offer": "0001-com-ubuntu-server-jammy",
"publisher": "Canonical",
"sku": "22_04-lts",
"version": "latest"
}
no
subnet_id The ID of the Subnet where this Network first Interface should be located in. string n/a yes
tags list of tags map(string) {} no

Outputs

Name Description
id Linux virtual machine scale set id
public_ips Public IP Address Prefix CIDR

License

Apache 2 Licensed. For more information please see LICENSE