Skip to content

Commit

Permalink
Merge tag 'v2.3.0-module-update' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarvna committed Nov 5, 2021
2 parents 5795647 + 1ba704f commit 5ad69e4
Show file tree
Hide file tree
Showing 9 changed files with 889 additions and 586 deletions.
273 changes: 211 additions & 62 deletions README.md

Large diffs are not rendered by default.

185 changes: 3 additions & 182 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,189 +4,10 @@ Azure virtual machine scale sets let you create and manage a group of identical,

This module deploys Windows or Linux virtual machine scale sets with Public / Private Load Balancer support and many other features.

## Module Usage
## Module Usage for

### Linux Virtual Machines Scale Sets

Following example creates Linux virtual machine scale sets with load balancer and auto scaling features.

```hcl
# Azurerm provider configuration
provider "azurerm" {
features {}
}
module "vmscaleset" {
source = "kumarvna/vm-scale-sets/azurerm"
version = "2.2.0"
# Resource Group and location, VNet and Subnet detials (Required)
resource_group_name = "rg-shared-westeurope-01"
virtual_network_name = "vnet-shared-hub-westeurope-001"
subnet_name = "snet-management"
vmscaleset_name = "testvmss"
# (Optional) To enable Azure Monitoring and install log analytics agents
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
log_analytics_workspace_name = var.log_analytics_workspace_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
deploy_log_analytics_agent = false
# This module support multiple Pre-Defined Linux and Windows Distributions.
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
os_flavor = "linux"
linux_distribution_name = "ubuntu1804"
generate_admin_ssh_key = false
admin_ssh_key_data = "~/.ssh/id_rsa.pub"
instances_count = 2
# Public and private load balancer support for VM scale sets
# Specify health probe port to allow LB to detect the backend endpoint status
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
# Specify the list of ports based on your requirement for Load balanced ports
# for additional data disks, provide the list for required size for the disk.
load_balancer_type = "public"
load_balancer_health_probe_port = 80
load_balanced_port_list = [80, 443]
additional_data_disks = [100, 200]
# Enable Auto scaling feature for VM scaleset by set argument to true.
# Instances_count in VMSS will become default and minimum instance count.
# Automatically scale out the number of VM instances based on CPU Average only.
enable_autoscale_for_vmss = true
minimum_instances_count = 2
maximum_instances_count = 5
scale_out_cpu_percentage_threshold = 80
scale_in_cpu_percentage_threshold = 20
# Network Seurity group port allow definitions for each Virtual Machine
# NSG association to be added automatically for all network interfaces.
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
# For production environments, we recommend using a VPN or private connection
nsg_inbound_rules = [
{
name = "http"
destination_port_range = "80"
source_address_prefix = "*"
},
{
name = "https"
destination_port_range = "443"
source_address_prefix = "*"
},
]
# Adding TAG's to your Azure resources (Required)
# ProjectName and Env are already declared above, to use them here, create a varible.
tags = {
ProjectName = "demo-internal"
Env = "dev"
Owner = "[email protected]"
BusinessUnit = "CORP"
ServiceClass = "Gold"
}
}
```

### Windows Virtual Machines Scale Sets

Following example creates Windows virtual machine scale sets with load balancer and auto scaling features.

```hcl
# Azurerm provider configuration
provider "azurerm" {
features {}
}
module "vmscaleset" {
source = "kumarvna/vm-scale-sets/azurerm"
version = "2.2.0"
# Resource Group and location, VNet and Subnet detials (Required)
resource_group_name = "rg-shared-westeurope-01"
virtual_network_name = "vnet-shared-hub-westeurope-001"
subnet_name = "snet-appgateway"
vmscaleset_name = "testvmss"
vm_computer_name = "websrv1"
# (Optional) To enable Azure Monitoring and install log analytics agents
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
log_analytics_workspace_name = var.log_analytics_workspace_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
deploy_log_analytics_agent = false
# This module support multiple Pre-Defined Linux and Windows Distributions.
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
os_flavor = "windows"
windows_distribution_name = "windows2019dc"
instances_count = 2
admin_username = "azureadmin"
admin_password = "P@$$w0rd1234!"
# Public and private load balancer support for VM scale sets
# Specify health probe port to allow LB to detect the backend endpoint status
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
# Specify the list of ports based on your requirement for Load balanced ports
# for additional data disks, provide the list for required size for the disk.
load_balancer_type = "public"
load_balancer_health_probe_port = 80
load_balanced_port_list = [80, 443]
additional_data_disks = [100, 200]
# Enable Auto scaling feature for VM scaleset by set argument to true.
# Instances_count in VMSS will become default and minimum instance count.
# Automatically scale out the number of VM instances based on CPU Average only.
enable_autoscale_for_vmss = true
minimum_instances_count = 2
maximum_instances_count = 5
scale_out_cpu_percentage_threshold = 80
scale_in_cpu_percentage_threshold = 20
# Deploy IIS server minimal installation on VMMS instances
intall_iis_server_on_instances = false
# Network Seurity group port allow definitions for each Virtual Machine
# NSG association to be added automatically for all network interfaces.
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
# For production environments, we recommend using a VPN or private connection
nsg_inbound_rules = [
{
name = "http"
destination_port_range = "80"
source_address_prefix = "*"
},
{
name = "https"
destination_port_range = "443"
source_address_prefix = "*"
},
]
# Adding TAG's to your Azure resources (Required)
# ProjectName and Env are already declared above, to use them here, create a varible.
tags = {
ProjectName = "demo-internal"
Env = "dev"
Owner = "[email protected]"
BusinessUnit = "CORP"
ServiceClass = "Gold"
}
}
```
* [Linux Virtual Machine Scale Set](linux_vm_scale_sets/)
* [Windows Virtual Machine Scale Set](windows_vm_scale_sets/)

## Terraform Usage

Expand Down
82 changes: 40 additions & 42 deletions examples/linux_vm_scale_sets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,47 @@ This module deploys Windows or Linux virtual machine scale sets with Public / Pr

## Module Usage

```hcl
```terraform
# Azurerm provider configuration
provider "azurerm" {
features {}
}
data "azurerm_log_analytics_workspace" "example" {
name = "loganalytics-we-sharedtest2"
resource_group_name = "rg-shared-westeurope-01"
}
module "vmscaleset" {
source = "kumarvna/vm-scale-sets/azurerm"
version = "2.2.0"
version = "2.3.0"
# Resource Group and location, VNet and Subnet detials (Required)
resource_group_name = "rg-shared-westeurope-01"
virtual_network_name = "vnet-shared-hub-westeurope-001"
subnet_name = "snet-management"
vmscaleset_name = "testvmss"
# (Optional) To enable Azure Monitoring and install log analytics agents
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
log_analytics_workspace_name = var.log_analytics_workspace_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
deploy_log_analytics_agent = false
# This module support multiple Pre-Defined Linux and Windows Distributions.
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
# Check the README.md file for more pre-defined images for Ubuntu, Centos, RedHat.
# Please make sure to use gen2 images supported VM sizes if you use gen2 distributions
# Specify `disable_password_authentication = false` to create random admin password
# Specify a valid password with `admin_password` argument to use your own password
# To generate SSH key pair, specify `generate_admin_ssh_key = true`
# To use existing key pair, specify `admin_ssh_key_data` to a valid SSH public key path.
os_flavor = "linux"
linux_distribution_name = "ubuntu1804"
generate_admin_ssh_key = false
admin_ssh_key_data = "~/.ssh/id_rsa.pub"
virtual_machine_size = "Standard_A2_v2"
admin_username = "azureadmin"
generate_admin_ssh_key = true
instances_count = 2
# Proxymity placement group, Automatic Instance repair and adding Public IP to VM's are optional.
# remove these argument from module if you dont want to use it.
enable_proximity_placement_group = true
assign_public_ip_to_each_vm_in_vmss = true
enable_automatic_instance_repair = true
# Public and private load balancer support for VM scale sets
# Specify health probe port to allow LB to detect the backend endpoint status
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
Expand All @@ -59,10 +64,14 @@ module "vmscaleset" {
scale_out_cpu_percentage_threshold = 80
scale_in_cpu_percentage_threshold = 20
# Boot diagnostics to troubleshoot virtual machines, by default uses managed
# To use custom storage account, specify `storage_account_name` with a valid name
# Passing a `null` value will utilize a Managed Storage Account to store Boot Diagnostics
enable_boot_diagnostics = true
# Network Seurity group port allow definitions for each Virtual Machine
# NSG association to be added automatically for all network interfaces.
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
# For production environments, we recommend using a VPN or private connection
# Remove this NSG rules block, if `existing_network_security_group_id` is specified
nsg_inbound_rules = [
{
name = "http"
Expand All @@ -77,10 +86,19 @@ module "vmscaleset" {
},
]
# Adding TAG's to your Azure resources (Required)
# ProjectName and Env are already declared above, to use them here, create a varible.
# (Optional) To enable Azure Monitoring and install log analytics agents
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.example.id
# Deploy log analytics agents to virtual machine.
# Log analytics workspace customer id and primary shared key required.
deploy_log_analytics_agent = true
log_analytics_customer_id = data.azurerm_log_analytics_workspace.example.workspace_id
log_analytics_workspace_primary_shared_key = data.azurerm_log_analytics_workspace.example.primary_shared_key
# Adding additional TAG's to your Azure resources
tags = {
ProjectName = "demo-internal"
ProjectName = "demo-project"
Env = "dev"
Owner = "[email protected]"
BusinessUnit = "CORP"
Expand All @@ -100,23 +118,3 @@ terraform apply
```

Run `terraform destroy` when you don't need these resources.

## Outputs

|Name | Description|
|---- | -----------|
`admin_ssh_key_public`|The generated public key data in PEM format
`admin_ssh_key_private`|The generated private key data in PEM format
`windows_vm_password`|Password for the windows Virtual Machine
`load_balancer_public_ip`|The Public IP address allocated for load balancer
`load_balancer_private_ip`|The Private IP address allocated for load balancer
`load_balancer_nat_pool_id`|The resource ID of the Load Balancer NAT pool
`load_balancer_health_probe_id`|The resource ID of the Load Balancer health Probe
`load_balancer_rules_id`|The resource ID of the Load Balancer Rule
`network_security_group_id`|The resource id of Network security group
`linux_virtual_machine_scale_set_name`|The name of the Linux Virtual Machine Scale Set
`linux_virtual_machine_scale_set_id`|The resource ID of the Linux Virtual Machine Scale Set
`linux_virtual_machine_scale_set_unique_id`|The unique ID of the Linux Virtual Machine Scale Set
`windows_virtual_machine_scale_set_name`|The name of the windows Virtual Machine Scale Set
`windows_virtual_machine_scale_set_id`|The resource ID of the windows Virtual Machine Scale Set
`windows_virtual_machine_scale_set_unique_id`|The unique ID of the windows Virtual Machine Scale Set
Loading

0 comments on commit 5ad69e4

Please sign in to comment.