@@ -4,42 +4,47 @@ This module deploys Windows or Linux virtual machine scale sets with Public / Pr
44
55## Module Usage
66
7- ``` hcl
7+ ``` terraform
88# Azurerm provider configuration
99provider "azurerm" {
1010 features {}
1111}
1212
13+ data "azurerm_log_analytics_workspace" "example" {
14+ name = "loganalytics-we-sharedtest2"
15+ resource_group_name = "rg-shared-westeurope-01"
16+ }
17+
1318module "vmscaleset" {
1419 source = "kumarvna/vm-scale-sets/azurerm"
15- version = "2.2 .0"
20+ version = "2.3 .0"
1621
1722 # Resource Group and location, VNet and Subnet detials (Required)
1823 resource_group_name = "rg-shared-westeurope-01"
1924 virtual_network_name = "vnet-shared-hub-westeurope-001"
2025 subnet_name = "snet-management"
2126 vmscaleset_name = "testvmss"
2227
23- # (Optional) To enable Azure Monitoring and install log analytics agents
24- # (Optional) Specify `storage_account_name` to save monitoring logs to storage.
25- log_analytics_workspace_name = var.log_analytics_workspace_name
26-
27- # Deploy log analytics agents to virtual machine. Log analytics workspace name required.
28- # Defaults to `false`
29- deploy_log_analytics_agent = false
30-
3128 # This module support multiple Pre-Defined Linux and Windows Distributions.
32- # These distributions support the Automatic OS image upgrades in virtual machine scale sets
33- # Linux images: ubuntu1804, ubuntu1604, centos75, coreos
34- # Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
35- # Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
36- # When you use Autoscaling feature, instances_count will become default and minimum instance count.
29+ # Check the README.md file for more pre-defined images for Ubuntu, Centos, RedHat.
30+ # Please make sure to use gen2 images supported VM sizes if you use gen2 distributions
31+ # Specify `disable_password_authentication = false` to create random admin password
32+ # Specify a valid password with `admin_password` argument to use your own password
33+ # To generate SSH key pair, specify `generate_admin_ssh_key = true`
34+ # To use existing key pair, specify `admin_ssh_key_data` to a valid SSH public key path.
3735 os_flavor = "linux"
3836 linux_distribution_name = "ubuntu1804"
39- generate_admin_ssh_key = false
40- admin_ssh_key_data = "~/.ssh/id_rsa.pub"
37+ virtual_machine_size = "Standard_A2_v2"
38+ admin_username = "azureadmin"
39+ generate_admin_ssh_key = true
4140 instances_count = 2
4241
42+ # Proxymity placement group, Automatic Instance repair and adding Public IP to VM's are optional.
43+ # remove these argument from module if you dont want to use it.
44+ enable_proximity_placement_group = true
45+ assign_public_ip_to_each_vm_in_vmss = true
46+ enable_automatic_instance_repair = true
47+
4348 # Public and private load balancer support for VM scale sets
4449 # Specify health probe port to allow LB to detect the backend endpoint status
4550 # Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
@@ -59,10 +64,14 @@ module "vmscaleset" {
5964 scale_out_cpu_percentage_threshold = 80
6065 scale_in_cpu_percentage_threshold = 20
6166
67+ # Boot diagnostics to troubleshoot virtual machines, by default uses managed
68+ # To use custom storage account, specify `storage_account_name` with a valid name
69+ # Passing a `null` value will utilize a Managed Storage Account to store Boot Diagnostics
70+ enable_boot_diagnostics = true
71+
6272 # Network Seurity group port allow definitions for each Virtual Machine
6373 # NSG association to be added automatically for all network interfaces.
64- # SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
65- # For production environments, we recommend using a VPN or private connection
74+ # Remove this NSG rules block, if `existing_network_security_group_id` is specified
6675 nsg_inbound_rules = [
6776 {
6877 name = "http"
@@ -77,10 +86,19 @@ module "vmscaleset" {
7786 },
7887 ]
7988
80- # Adding TAG's to your Azure resources (Required)
81- # ProjectName and Env are already declared above, to use them here, create a varible.
89+ # (Optional) To enable Azure Monitoring and install log analytics agents
90+ # (Optional) Specify `storage_account_name` to save monitoring logs to storage.
91+ log_analytics_workspace_id = data.azurerm_log_analytics_workspace.example.id
92+
93+ # Deploy log analytics agents to virtual machine.
94+ # Log analytics workspace customer id and primary shared key required.
95+ deploy_log_analytics_agent = true
96+ log_analytics_customer_id = data.azurerm_log_analytics_workspace.example.workspace_id
97+ log_analytics_workspace_primary_shared_key = data.azurerm_log_analytics_workspace.example.primary_shared_key
98+
99+ # Adding additional TAG's to your Azure resources
82100 tags = {
83- ProjectName = "demo-internal "
101+ ProjectName = "demo-project "
84102 Env = "dev"
8510386104 BusinessUnit = "CORP"
@@ -100,23 +118,3 @@ terraform apply
100118```
101119
102120Run ` terraform destroy ` when you don't need these resources.
103-
104- ## Outputs
105-
106- | Name | Description|
107- | ---- | -----------|
108- ` admin_ssh_key_public ` |The generated public key data in PEM format
109- ` admin_ssh_key_private ` |The generated private key data in PEM format
110- ` windows_vm_password ` |Password for the windows Virtual Machine
111- ` load_balancer_public_ip ` |The Public IP address allocated for load balancer
112- ` load_balancer_private_ip ` |The Private IP address allocated for load balancer
113- ` load_balancer_nat_pool_id ` |The resource ID of the Load Balancer NAT pool
114- ` load_balancer_health_probe_id ` |The resource ID of the Load Balancer health Probe
115- ` load_balancer_rules_id ` |The resource ID of the Load Balancer Rule
116- ` network_security_group_id ` |The resource id of Network security group
117- ` linux_virtual_machine_scale_set_name ` |The name of the Linux Virtual Machine Scale Set
118- ` linux_virtual_machine_scale_set_id ` |The resource ID of the Linux Virtual Machine Scale Set
119- ` linux_virtual_machine_scale_set_unique_id ` |The unique ID of the Linux Virtual Machine Scale Set
120- ` windows_virtual_machine_scale_set_name ` |The name of the windows Virtual Machine Scale Set
121- ` windows_virtual_machine_scale_set_id ` |The resource ID of the windows Virtual Machine Scale Set
122- ` windows_virtual_machine_scale_set_unique_id ` |The unique ID of the windows Virtual Machine Scale Set
0 commit comments