Skip to content

Commit b14f96e

Browse files
Merge pull request openshift#7312 from mresvanis/add-confidential-vm-support-for-azure
MGMT-13628: add support for confidential VMs on Azure
2 parents 0367c39 + 4cdf6d7 commit b14f96e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3370
-192
lines changed

data/data/azure/bootstrap/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ resource "azurerm_linux_virtual_machine" "bootstrap" {
204204
admin_password = "NotActuallyApplied!"
205205
disable_password_authentication = false
206206
encryption_at_host_enabled = var.azure_master_encryption_at_host_enabled
207+
secure_boot_enabled = var.azure_master_secure_boot == "Enabled"
208+
vtpm_enabled = var.azure_master_virtualized_trusted_platform_module == "Enabled"
207209

208210
identity {
209211
type = "UserAssigned"
@@ -216,6 +218,9 @@ resource "azurerm_linux_virtual_machine" "bootstrap" {
216218
storage_account_type = var.azure_master_root_volume_type
217219
disk_size_gb = 100
218220
disk_encryption_set_id = var.azure_master_disk_encryption_set_id
221+
222+
security_encryption_type = var.azure_master_security_encryption_type
223+
secure_vm_disk_encryption_set_id = var.azure_master_secure_vm_disk_encryption_set_id
219224
}
220225

221226
# Either source_image_id or source_image_reference must be defined

data/data/azure/cluster/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ module "master" {
4848
vm_image_sku = var.azure_marketplace_image_sku
4949
vm_image_version = var.azure_marketplace_image_version
5050

51+
security_encryption_type = var.azure_master_security_encryption_type
52+
secure_vm_disk_encryption_set_id = var.azure_master_secure_vm_disk_encryption_set_id
53+
secure_boot = var.azure_master_secure_boot
54+
virtualized_trusted_platform_module = var.azure_master_virtualized_trusted_platform_module
55+
5156
use_ipv4 = var.use_ipv4
5257
use_ipv6 = var.use_ipv6
5358
}

data/data/azure/cluster/master/master.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ resource "azurerm_linux_virtual_machine" "master" {
100100
admin_password = "NotActuallyApplied!"
101101
disable_password_authentication = false
102102
encryption_at_host_enabled = var.encryption_at_host_enabled
103+
secure_boot_enabled = var.secure_boot == "Enabled"
104+
vtpm_enabled = var.virtualized_trusted_platform_module == "Enabled"
103105

104106
additional_capabilities {
105107
ultra_ssd_enabled = var.ultra_ssd_enabled
@@ -116,6 +118,9 @@ resource "azurerm_linux_virtual_machine" "master" {
116118
storage_account_type = var.os_volume_type
117119
disk_size_gb = var.os_volume_size
118120
disk_encryption_set_id = var.disk_encryption_set_id
121+
122+
security_encryption_type = var.security_encryption_type
123+
secure_vm_disk_encryption_set_id = var.secure_vm_disk_encryption_set_id
119124
}
120125

121126
# Either source_image_id or source_image_reference must be defined

data/data/azure/cluster/master/variables.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,36 @@ networking_type specifies whether to enable accelerated networking. Accelerated
174174
enables single root I/O virtualization (SR-IOV) to a VM, greatly improving its networking performance.
175175
EOF
176176
}
177+
178+
variable "security_encryption_type" {
179+
type = string
180+
default = null
181+
182+
description = <<EOF
183+
Defines the encryption type when the Virtual Machine is a Confidential VM. Possible values are VMGuestStateOnly and DiskWithVMGuestState.
184+
When set to "VMGuestStateOnly" vtpm_enabled should be set to true.
185+
When set to "DiskWithVMGuestState" both vtpm_enabled and secure_boot_enabled should be true.
186+
EOF
187+
}
188+
189+
variable "secure_vm_disk_encryption_set_id" {
190+
type = string
191+
default = null
192+
193+
description = <<EOF
194+
Defines the ID of the Disk Encryption Set which should be used to encrypt this OS Disk when the Virtual Machine is a Confidential VM.
195+
It can only be set when security_encryption_type is set to "DiskWithVMGuestState".
196+
EOF
197+
}
198+
199+
variable "secure_boot" {
200+
type = string
201+
default = ""
202+
description = "Defines whether secure boot should be enabled on the virtual machine."
203+
}
204+
205+
variable "virtualized_trusted_platform_module" {
206+
type = string
207+
default = ""
208+
description = "Defines whether vTPM should be enabled on the virtual machine."
209+
}

data/data/azure/variables-azure.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,36 @@ variable "azure_marketplace_image_version" {
250250
description = "Version of the marketplace image"
251251
default = ""
252252
}
253+
254+
variable "azure_master_security_encryption_type" {
255+
type = string
256+
default = null
257+
258+
description = <<EOF
259+
Defines the encryption type when the Virtual Machine is a Confidential VM. Possible values are VMGuestStateOnly and DiskWithVMGuestState.
260+
When set to "VMGuestStateOnly" azure_master_vtpm_enabled should be set to true.
261+
When set to "DiskWithVMGuestState" both azure_master_vtp_enabled and azure_master_secure_boot_enabled should be true.
262+
EOF
263+
}
264+
265+
variable "azure_master_secure_vm_disk_encryption_set_id" {
266+
type = string
267+
default = null
268+
269+
description = <<EOF
270+
Defines the ID of the Disk Encryption Set which should be used to encrypt this OS Disk when the Virtual Machine is a Confidential VM.
271+
It can only be set when azure_master_security_encryption_type is set to "DiskWithVMGuestState".
272+
EOF
273+
}
274+
275+
variable "azure_master_secure_boot" {
276+
type = string
277+
description = "Defines whether the instance should have secure boot enabled."
278+
default = ""
279+
}
280+
281+
variable "azure_master_virtualized_trusted_platform_module" {
282+
type = string
283+
description = "Defines whether the instance should have vTPM enabled."
284+
default = ""
285+
}

data/data/azure/vnet/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ resource "azurerm_shared_image" "clustergen2" {
128128
hyper_v_generation = "V2"
129129
architecture = var.azure_vm_architecture
130130

131+
confidential_vm_supported = var.azure_master_security_encryption_type != null ? true : null
132+
133+
trusted_launch_enabled = var.azure_master_security_encryption_type == null ? (var.azure_master_secure_boot == "Enabled" || var.azure_master_virtualized_trusted_platform_module == "Enabled") : null
134+
131135
identifier {
132136
publisher = "RedHat-gen2"
133137
offer = "rhcos-gen2"

0 commit comments

Comments
 (0)