Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/vmss_existing_vnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module "example_module" {
availability_zones_num = "1"
minimum_number_of_vm_instances = 2
maximum_number_of_vm_instances = 10
number_of_vm_instances = 2
management_name = "mgmt"
management_IP = "13.92.42.181"
management_interface = "eth1-private"
Expand Down Expand Up @@ -108,6 +109,7 @@ module "example_module" {
| **availability_zones_num** | A list of a single item of the Availability Zone which the Virtual Machine should be allocated in | string | "centralus", "eastus2", "francecentral", "northeurope", "southeastasia", "westeurope", "westus2", "eastus", "uksouth". |
| **minimum_number_of_vm_instances** | The minimum number of VMSS instances for this resource | number | Valid values are in the range 0 - 10. |
| **maximum_number_of_vm_instances** | The maximum number of VMSS instances for this resource | number | Valid values are in the range 0 - 10. |
| **number_of_vm_instances** | The default number of VMSS instances to deploy. | number | The number of VMSS instances must not be less then `minimum_number_of_vm_instances`. If the number of VMSS is greater then the `maximum_number_of_vm_instances` use the maximum number as default.<br/>**Default**: 2; |
| **management_name** | The name of the management server as it appears in the configuration file | string | Field cannot be empty. Only alphanumeric characters or '_'/'-' are allowed, and the name must be 1-30 characters long. |
| **management_IP** | The IP address used to manage the VMSS instances | string | A valid IP address. |
| **management_interface** | Management option for the Gateways in the VMSS | string | "eth0-public" - Manages the GWs using their external NIC's public IP address;<br/>"eth0-private" - Manages the GWs using their external NIC's private IP address;<br/>"eth1-private" - Manages the GWs using their internal NIC's private IP address.<br/>**Default:** "eth1-private" |
Expand Down
16 changes: 16 additions & 0 deletions modules/vmss_existing_vnet/locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
locals {
module_name = "vmss_terraform_registry"
module_version = "1.0.5"

// Validate that the minimum number of VM instances is at least 0.
// If not, return an error message.
validate_number_of_vm_instances_range = var.minimum_number_of_vm_instances >= 0 && var.maximum_number_of_vm_instances >= 0 ? 0 : index("error: The minimum and maximum number of VM instances must be at least 0.")

// Validate that the maximum number of VM instances is greater than or equal to the minimum number of VM instances.
// If not, return an error message.
validate_maximum_number_of_vm_instances = var.maximum_number_of_vm_instances >= var.minimum_number_of_vm_instances ? 0 : index("error: The maximum number of VM instances must be greater than or equal to the minimum number of VM instances.")

// The number of VM instances should not exceed the maximum allowed.
// If the provided number of instances exceeds the maximum, use the maximum instead.
number_of_vm_instances = var.maximum_number_of_vm_instances >= var.number_of_vm_instances ? var.number_of_vm_instances : var.maximum_number_of_vm_instances

// Validate the number of VM instances against the minimum requirement.
// If the number of instances is less than the minimum, return an error message.
validate_number_of_vm_instances = local.number_of_vm_instances >= var.minimum_number_of_vm_instances? 0 : index("error: The number of VM instances must be at least ${var.minimum_number_of_vm_instances}.")
}
4 changes: 2 additions & 2 deletions modules/vmss_existing_vnet/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module "common" {
installation_type = var.installation_type
module_name = local.module_name
module_version = local.module_version
number_of_vm_instances = var.number_of_vm_instances
number_of_vm_instances = local.number_of_vm_instances
allow_upload_download = var.allow_upload_download
vm_size = var.vm_size
disk_size = var.disk_size
Expand Down Expand Up @@ -217,7 +217,7 @@ resource "azurerm_linux_virtual_machine_scale_set" "vmss" {
resource_group_name = module.common.resource_group_name
sku = module.common.vm_size
zones = local.availability_zones_num_condition
instances = var.number_of_vm_instances
instances = local.number_of_vm_instances
overprovision = false

dynamic "identity" {
Expand Down
6 changes: 4 additions & 2 deletions modules/vmss_new_vnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module "example_module" {
availability_zones_num = "1"
minimum_number_of_vm_instances = 2
maximum_number_of_vm_instances = 10
number_of_vm_instances = 2
management_name = "mgmt"
management_IP = "13.92.42.181"
management_interface = "eth1-private"
Expand Down Expand Up @@ -105,8 +106,9 @@ module "example_module" {
| **allow_upload_download** | Automatically download Blade Contracts and other important data. Improve product experience by sending data to Check Point | boolean | true;<br />false;<br /> |
| **authentication_type** | Specifies whether a password authentication or SSH Public Key authentication should be used | string | "Password";<br />"SSH Public Key";<br /> |
| **availability_zones_num** | A list of a single item of the Availability Zone where the Virtual Machine should be allocated | string | "centralus", "eastus2", "francecentral", "northeurope", "southeastasia", "westeurope", "westus2", "eastus", "uksouth"<br /> |
| **minimum_number_of_vm_instances** | The minimum number of VMSS instances for this resource | number | Valid values are in the range 0 - 10<br /> |
| **maximum_number_of_vm_instances** | The maximum number of VMSS instances for this resource | number | Valid values are in the range 0 - 10<br /> |
| **minimum_number_of_vm_instances** | The minimum number of VMSS instances for this resource. | number | Valid values are in the range 0 - 10<br /> |
| **maximum_number_of_vm_instances** | The maximum number of VMSS instances for this resource. | number | Valid values are in the range 0 - 10<br /> |
| **number_of_vm_instances** | The default number of VMSS instances to deploy. | number | The number of VMSS instances must not be less then `minimum_number_of_vm_instances`. If the number of VMSS is greater then the `maximum_number_of_vm_instances` use the maximum number by default.<br/>**Default**: 2; |
| **management_name** | The name of the management server as it appears in the configuration file | string | Field cannot be empty. Only alphanumeric characters or '_'/'-' are allowed, and the name must be 1-30 characters long<br /> |
| **management_IP** | The IP address used to manage the VMSS instances | string | A valid IP address<br /> |
| **management_interface** | Management option for the Gateways in the VMSS | string | "eth0-public" - Manages the GWs using their external NIC's public IP address;<br />"eth0-private" - Manages the GWs using their external NIC's private IP address;<br />"eth1-private" - Manages the GWs using their internal NIC's private IP address;<br />**Default:** "eth1-private" |
Expand Down
16 changes: 16 additions & 0 deletions modules/vmss_new_vnet/locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
locals {
module_name = "vmss_terraform_registry"
module_version = "1.0.5"

// Validate that the minimum number of VM instances is at least 0.
// If not, return an error message.
validate_number_of_vm_instances_range = var.minimum_number_of_vm_instances >= 0 && var.maximum_number_of_vm_instances >= 0 ? 0 : index("error: The minimum and maximum number of VM instances must be at least 0.")

// Validate that the maximum number of VM instances is greater than or equal to the minimum number of VM instances.
// If not, return an error message.
validate_maximum_number_of_vm_instances = var.maximum_number_of_vm_instances >= var.minimum_number_of_vm_instances ? 0 : index("error: The maximum number of VM instances must be greater than or equal to the minimum number of VM instances.")

// The number of VM instances should not exceed the maximum allowed.
// If the provided number of instances exceeds the maximum, use the maximum instead.
number_of_vm_instances = var.maximum_number_of_vm_instances >= var.number_of_vm_instances ? var.number_of_vm_instances : var.maximum_number_of_vm_instances

// Validate the number of VM instances against the minimum requirement.
// If the number of instances is less than the minimum, return an error message.
validate_number_of_vm_instances = local.number_of_vm_instances >= var.minimum_number_of_vm_instances? 0 : index("error: The number of VM instances must be at least ${var.minimum_number_of_vm_instances}.")
}
4 changes: 2 additions & 2 deletions modules/vmss_new_vnet/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module "common" {
installation_type = var.installation_type
module_name = local.module_name
module_version = local.module_version
number_of_vm_instances = var.number_of_vm_instances
number_of_vm_instances = local.number_of_vm_instances
allow_upload_download = var.allow_upload_download
vm_size = var.vm_size
disk_size = var.disk_size
Expand Down Expand Up @@ -213,7 +213,7 @@ resource "azurerm_linux_virtual_machine_scale_set" "vmss" {
resource_group_name = module.common.resource_group_name
sku = module.common.vm_size
zones = local.availability_zones_num_condition
instances = var.number_of_vm_instances
instances = local.number_of_vm_instances
overprovision = false

dynamic "identity" {
Expand Down
Loading