diff --git a/modules/common/common/variables.tf b/modules/common/common/variables.tf
index 5d0997a..8109502 100644
--- a/modules/common/common/variables.tf
+++ b/modules/common/common/variables.tf
@@ -242,10 +242,15 @@ variable "vm_os_sku" {
type = string
validation {
+ # The '-gen2' SKUs are the value composed internally when hyper_v_generation = "V2";
+ # users pass the base SKU, so they are intentionally omitted from the error message.
condition = contains([
"sg-byol",
"sg-ngtp",
"sg-ngtx",
+ "sg-byol-gen2",
+ "sg-ngtp-gen2",
+ "sg-ngtx-gen2",
"mgmt-byol",
"mgmt-25"
], var.vm_os_sku)
diff --git a/modules/common/custom-image/main.tf b/modules/common/custom-image/main.tf
index 8756124..ebf6506 100644
--- a/modules/common/custom-image/main.tf
+++ b/modules/common/custom-image/main.tf
@@ -3,6 +3,7 @@ resource "azurerm_image" "custom_image" {
name = "custom-image"
location = var.location
resource_group_name = var.resource_group_name
+ hyper_v_generation = var.hyper_v_generation
os_disk {
os_type = "Linux"
diff --git a/modules/common/custom-image/variables.tf b/modules/common/custom-image/variables.tf
index 7bd3d03..542d5ce 100644
--- a/modules/common/custom-image/variables.tf
+++ b/modules/common/custom-image/variables.tf
@@ -31,3 +31,13 @@ variable "storage_type" {
error_message = "Variable [storage_type] must be one of 'Standard_LRS', 'Premium_LRS'."
}
}
+
+variable "hyper_v_generation" {
+ description = "The Hyper-V generation of the custom image. Select V2 to create a Generation 2 image. Only applies when a custom image URI is provided. Changing this value forces a new image to be created."
+ type = string
+ default = "V1"
+ validation {
+ condition = contains(["V1", "V2"], var.hyper_v_generation)
+ error_message = "Variable [hyper_v_generation] must be one of 'V1', 'V2'."
+ }
+}
diff --git a/modules/high-availability/README.md b/modules/high-availability/README.md
index 273b0fb..0a3c9a1 100644
--- a/modules/high-availability/README.md
+++ b/modules/high-availability/README.md
@@ -202,6 +202,7 @@ Usage: `storage_account_deployment_mode = "None"`
| **os_version** | GAIA OS version. | string | "R8110";
"R8120";
"R82";
"R8210"; | N/A | Yes |
| **vm_os_sku** | A SKU of the image to be deployed. | string | "sg-byol" - BYOL license;
"sg-ngtp" - NGTP PAYG license;
"sg-ngtx" - NGTX PAYG license; | N/A | Yes |
| **vm_os_offer** | The name of the image offer to be deployed. | string | "check-point-cg-r8110";
"check-point-cg-r8120";
"check-point-cg-r82";
"check-point-cg-r8210"; | N/A | Yes |
+| **hyper_v_generation** | The Hyper-V generation of the virtual machine. Set to 'V2' to deploy a Generation 2 VM, or 'V1' for Generation 1. 'V2' is supported on Gaia version R82.10 or later. | string | "V1";
"V2"; | "V1" | No |
| **allow_upload_download** | Automatically download Blade Contracts and other important data. Improve product experience by sending data to Check Point. | boolean | true;
false; | N/A | Yes |
| **admin_shell** | Enables selecting different admin shells. | string | /etc/cli.sh;
/bin/bash;
/bin/csh;
/bin/tcsh; | "/etc/cli.sh" | No |
| **bootstrap_script** | An optional script to run on the initial boot. | string | Bootstrap script example:
"touch /home/admin/bootstrap.txt; echo 'hello_world' > /home/admin/bootstrap.txt" | "" | No |
diff --git a/modules/high-availability/main.tf b/modules/high-availability/main.tf
index 45dd591..198fe45 100644
--- a/modules/high-availability/main.tf
+++ b/modules/high-availability/main.tf
@@ -16,7 +16,7 @@ module "common" {
disk_size = var.disk_size
is_blink = var.is_blink
os_version = var.os_version
- vm_os_sku = var.vm_os_sku
+ vm_os_sku = "${var.vm_os_sku}${var.hyper_v_generation == "V2" ? "-gen2" : ""}"
vm_os_offer = var.vm_os_offer
authentication_type = var.authentication_type
serial_console_password_hash = var.serial_console_password_hash
@@ -356,6 +356,7 @@ module "vm_boot_diagnostics_storage" {
module "custom_image" {
source = "../common/custom-image"
source_image_vhd_uri = var.source_image_vhd_uri
+ hyper_v_generation = var.hyper_v_generation
resource_group_name = module.common.resource_group_name
location = module.common.resource_group_location
storage_type = var.storage_account_type
diff --git a/modules/high-availability/variables.tf b/modules/high-availability/variables.tf
index 1871a34..b8d48cc 100644
--- a/modules/high-availability/variables.tf
+++ b/modules/high-availability/variables.tf
@@ -69,6 +69,20 @@ variable "source_image_vhd_uri" {
default = "noCustomUri"
}
+variable "hyper_v_generation" {
+ description = "The Hyper-V generation of the virtual machine. Set to 'V2' to deploy a Generation 2 VM, or 'V1' for Generation 1. 'V2' is supported on Gaia version R82.10 or later."
+ type = string
+ default = "V1"
+ validation {
+ condition = contains(["V1", "V2"], var.hyper_v_generation)
+ error_message = "Variable [hyper_v_generation] must be one of 'V1', 'V2'."
+ }
+ validation {
+ condition = var.hyper_v_generation != "V2" || var.source_image_vhd_uri != "noCustomUri" || !contains(["R8110", "R8120", "R82"], var.os_version)
+ error_message = "hyper_v_generation can be set to 'V2' only for a custom image, or for a marketplace image on Gaia version R82.10 or later."
+ }
+}
+
variable "admin_username" {
description = "Administrator username of deployed VM. Due to Azure limitations 'notused' name can be used."
type = string
diff --git a/modules/single-gateway/README.md b/modules/single-gateway/README.md
index 4dc04ee..82f272f 100644
--- a/modules/single-gateway/README.md
+++ b/modules/single-gateway/README.md
@@ -330,6 +330,7 @@ Usage: `storage_account_deployment_mode = "None"`
| **os_version** | GAIA OS version. | string | "R8110";
"R8120";
"R82";
"R8210"; | N/A | Yes |
| **vm_os_sku** | A SKU of the image to be deployed. | string | "sg-byol" - BYOL license;
"sg-ngtp" - NGTP PAYG license;
"sg-ngtx" - NGTX PAYG license; | N/A | Yes |
| **vm_os_offer** | The name of the image offer to be deployed. | string | "check-point-cg-r8110";
"check-point-cg-r8120";
"check-point-cg-r82";
"check-point-cg-r8210"; | N/A | Yes |
+| **hyper_v_generation** | The Hyper-V generation of the virtual machine. Set to 'V2' to deploy a Generation 2 VM, or 'V1' for Generation 1. 'V2' is supported on Gaia version R82.10 or later and is not supported with installation_type 'standalone'. | string | "V1";
"V2"; | "V1" | No |
| **allow_upload_download**| Automatically download Blade Contracts and other important data. Improve product experience by sending data to Check Point. | boolean | true;
false; | N/A | Yes |
| **admin_shell** | Enables selecting different admin shells. | string | /etc/cli.sh;
/bin/bash;
/bin/csh;
/bin/tcsh; | "/etc/cli.sh" | No |
| **bootstrap_script** | An optional script to run on the initial boot. | string | Bootstrap script example:
"touch /home/admin/bootstrap.txt; echo 'hello_world' > /home/admin/bootstrap.txt" | "" | No |
diff --git a/modules/single-gateway/locals.tf b/modules/single-gateway/locals.tf
index a337df1..9f67225 100644
--- a/modules/single-gateway/locals.tf
+++ b/modules/single-gateway/locals.tf
@@ -5,7 +5,7 @@ locals {
"losangeles" = ["westus"]
"perth" = ["australiaeast"]
}
- vm_os_sku = var.installation_type == "standalone" ? "mgmt-byol" : var.vm_os_sku
+ vm_os_sku = "${var.installation_type == "standalone" ? "mgmt-byol" : var.vm_os_sku}${(var.hyper_v_generation == "V2" && var.installation_type != "standalone") ? "-gen2" : ""}"
is_blink = var.installation_type == "gateway"
template_name = var.enable_ipv6 ? "single_terraform_registry_dual_stack" : "single_terraform_registry"
}
diff --git a/modules/single-gateway/main.tf b/modules/single-gateway/main.tf
index c3dfddd..88b3570 100644
--- a/modules/single-gateway/main.tf
+++ b/modules/single-gateway/main.tf
@@ -263,6 +263,7 @@ module "vm_boot_diagnostics_storage" {
module "custom_image" {
source = "../common/custom-image"
source_image_vhd_uri = var.source_image_vhd_uri
+ hyper_v_generation = var.hyper_v_generation
resource_group_name = module.common.resource_group_name
location = module.common.resource_group_location
storage_type = var.storage_account_type
diff --git a/modules/single-gateway/variables.tf b/modules/single-gateway/variables.tf
index 75a1c5b..fa0db05 100644
--- a/modules/single-gateway/variables.tf
+++ b/modules/single-gateway/variables.tf
@@ -69,6 +69,20 @@ variable "source_image_vhd_uri" {
default = "noCustomUri"
}
+variable "hyper_v_generation" {
+ description = "The Hyper-V generation of the virtual machine. Set to 'V2' to deploy a Generation 2 VM, or 'V1' for Generation 1. 'V2' is supported on Gaia version R82.10 or later and is not supported with installation_type 'standalone'."
+ type = string
+ default = "V1"
+ validation {
+ condition = contains(["V1", "V2"], var.hyper_v_generation)
+ error_message = "Variable [hyper_v_generation] must be one of 'V1', 'V2'."
+ }
+ validation {
+ condition = var.hyper_v_generation != "V2" || var.source_image_vhd_uri != "noCustomUri" || (!contains(["R8110", "R8120", "R82"], var.os_version) && var.installation_type != "standalone")
+ error_message = "hyper_v_generation can be set to 'V2' only for a custom image, or for a marketplace image on Gaia version R82.10 or later and not with installation_type 'standalone'."
+ }
+}
+
variable "admin_username" {
description = "Administrator username of deployed VM. Due to Azure limitations 'notused' name can be used."
type = string
diff --git a/modules/vmss/README.md b/modules/vmss/README.md
index 565f91b..ee81a23 100644
--- a/modules/vmss/README.md
+++ b/modules/vmss/README.md
@@ -417,6 +417,7 @@ For more information, refer to the [Azure Terraform documentation](https://regis
| **os_version** | GAIA OS version. | string | "R8110";
"R8120";
"R82";
"R8210"; | N/A | Yes |
| **vm_os_sku** | A SKU of the image to be deployed. | string | "sg-byol" - BYOL license;
"sg-ngtp" - NGTP PAYG license;
"sg-ngtx" - NGTX PAYG license; | N/A | Yes |
| **vm_os_offer** | The name of the image offer to be deployed. | string | "check-point-cg-r8110";
"check-point-cg-r8120";
"check-point-cg-r82";
"check-point-cg-r8210"; | N/A | Yes |
+| **hyper_v_generation** | The Hyper-V generation of the virtual machine. Set to 'V2' to deploy a Generation 2 VM, or 'V1' for Generation 1. 'V2' is supported on Gaia version R82.10 or later. | string | "V1";
"V2"; | "V1" | No |
| **allow_upload_download** | Automatically download Blade Contracts and other important data. Improve product experience by sending data to Check Point. | boolean | true;
false; | N/A | Yes |
| **admin_shell** | Enables selecting different admin shells. | string | /etc/cli.sh;
/bin/bash;
/bin/csh;
/bin/tcsh; | "/etc/cli.sh" | No |
| **bootstrap_script** | An optional script to run on the initial boot. | string | Bootstrap script example:
"touch /home/admin/bootstrap.txt; echo 'hello_world' > /home/admin/bootstrap.txt" | "" | No |
diff --git a/modules/vmss/main.tf b/modules/vmss/main.tf
index 29def37..cec79d9 100644
--- a/modules/vmss/main.tf
+++ b/modules/vmss/main.tf
@@ -18,7 +18,7 @@ module "common" {
disk_size = var.disk_size
is_blink = var.is_blink
os_version = var.os_version
- vm_os_sku = var.vm_os_sku
+ vm_os_sku = "${var.vm_os_sku}${var.hyper_v_generation == "V2" ? "-gen2" : ""}"
vm_os_offer = var.vm_os_offer
authentication_type = var.authentication_type
serial_console_password_hash = var.serial_console_password_hash
@@ -350,6 +350,7 @@ module "vm_boot_diagnostics_storage" {
module "custom_image" {
source = "../common/custom-image"
source_image_vhd_uri = var.source_image_vhd_uri
+ hyper_v_generation = var.hyper_v_generation
resource_group_name = module.common.resource_group_name
location = module.common.resource_group_location
tags = merge(lookup(var.tags, "custom-image", {}), lookup(var.tags, "all", {}))
diff --git a/modules/vmss/variables.tf b/modules/vmss/variables.tf
index 96f0a89..9248c06 100644
--- a/modules/vmss/variables.tf
+++ b/modules/vmss/variables.tf
@@ -65,6 +65,20 @@ variable "source_image_vhd_uri" {
default = "noCustomUri"
}
+variable "hyper_v_generation" {
+ description = "The Hyper-V generation of the virtual machine. Set to 'V2' to deploy a Generation 2 VM, or 'V1' for Generation 1. 'V2' is supported on Gaia version R82.10 or later."
+ type = string
+ default = "V1"
+ validation {
+ condition = contains(["V1", "V2"], var.hyper_v_generation)
+ error_message = "Variable [hyper_v_generation] must be one of 'V1', 'V2'."
+ }
+ validation {
+ condition = var.hyper_v_generation != "V2" || var.source_image_vhd_uri != "noCustomUri" || !contains(["R8110", "R8120", "R82"], var.os_version)
+ error_message = "hyper_v_generation can be set to 'V2' only for a custom image, or for a marketplace image on Gaia version R82.10 or later."
+ }
+}
+
variable "admin_username" {
description = "Administrator username of deployed VM. Due to Azure limitations 'notused' name can be used."
type = string