Skip to content

Commit

Permalink
Update disk size for Linux and Windows VMs
Browse files Browse the repository at this point in the history
Fixes #4317

Add support for configurable OS disk account type and size for Linux and Windows VMs.

* **Linux VM Changes:**
  - Add new parameters `os_disk_account_type` and `os_disk_size` in `parameters.json`.
  - Update `porter.yaml` to include new parameters and update `install`, `upgrade`, and `uninstall` steps.
  - Add new properties `os_disk_account_type` and `os_disk_size` in `template_schema.json` and update the `required` array.
  - Add new variables `os_disk_account_type` and `os_disk_size` in `variables.tf`.
  - Update `os_disk` block in `linuxvm.tf` to use new variables `os_disk_account_type` and `os_disk_size`.

* **Windows VM Changes:**
  - Add new parameters `os_disk_account_type` and `os_disk_size` in `parameters.json`.
  - Update `porter.yaml` to include new parameters and update `install`, `upgrade`, and `uninstall` steps.
  - Add new properties `os_disk_account_type` and `os_disk_size` in `template_schema.json` and update the `required` array.
  - Add new variables `os_disk_account_type` and `os_disk_size` in `variables.tf`.
  - Update `os_disk` block in `windowsvm.tf` to use new variables `os_disk_account_type` and `os_disk_size`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/AzureTRE/issues/4317?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
marrobi committed Feb 6, 2025
1 parent 8153f8e commit e84d97b
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 3 deletions.
12 changes: 12 additions & 0 deletions ...lates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/parameters.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@
"source": {
"env": "KEY_STORE_ID"
}
},
{
"name": "os_disk_account_type",
"source": {
"env": "OS_DISK_ACCOUNT_TYPE"
}
},
{
"name": "os_disk_size",
"source": {
"env": "OS_DISK_SIZE"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ parameters:
type: string
description: "Timezone for the shutdown schedule"
default: "UTC"
- name: os_disk_account_type
type: string
default: "Standard_LRS"
description: "The type of storage account to use for the OS disk"
- name: os_disk_size
type: int
default: 64
description: "The size of the OS disk in GB"

# the following are added automatically by the resource processor
- name: id
Expand Down Expand Up @@ -166,6 +174,8 @@ install:
shutdown_timezone: ${ bundle.parameters.shutdown_timezone }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
os_disk_account_type: ${ bundle.parameters.os_disk_account_type }
os_disk_size: ${ bundle.parameters.os_disk_size }
backendConfig:
use_azuread_auth: "true"
use_oidc: "true"
Expand Down Expand Up @@ -197,6 +207,8 @@ upgrade:
shutdown_timezone: ${ bundle.parameters.shutdown_timezone }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
os_disk_account_type: ${ bundle.parameters.os_disk_account_type }
os_disk_size: ${ bundle.parameters.os_disk_size }
backendConfig:
use_azuread_auth: "true"
use_oidc: "true"
Expand Down Expand Up @@ -240,6 +252,8 @@ uninstall:
shutdown_timezone: ${ bundle.parameters.shutdown_timezone }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
os_disk_account_type: ${ bundle.parameters.os_disk_account_type }
os_disk_size: ${ bundle.parameters.os_disk_size }
backendConfig:
use_azuread_auth: "true"
use_oidc: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"description": "Linux virtual machine.",
"required": [
"os_image",
"vm_size"
"vm_size",
"os_disk_account_type",
"os_disk_size"
],
"authorizedRoles": [
"WorkspaceOwner", "WorkspaceResearcher"
Expand Down Expand Up @@ -49,6 +51,38 @@
"title": "Enable Shutdown Schedule",
"default": false,
"description": "Enable automatic shutdown schedule for the VM"
},
"os_disk_account_type": {
"$id": "#/properties/os_disk_account_type",
"type": "string",
"title": "OS Disk Account Type",
"description": "The type of storage account to use for the OS disk",
"default": "Standard_LRS",
"enum": [
"Standard_LRS",
"Premium_LRS",
"StandardSSD_LRS",
"UltraSSD_LRS"
]
},
"os_disk_size": {
"$id": "#/properties/os_disk_size",
"type": "integer",
"title": "OS Disk Size",
"description": "The size of the OS disk in GB",
"default": 64,
"enum": [
64,
128,
256,
512,
1024,
2048,
4096,
8192,
16384,
32767
]
}
},
"allOf": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ resource "azurerm_linux_virtual_machine" "linuxvm" {
os_disk {
name = "osdisk-${local.vm_name}"
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
storage_account_type = var.os_disk_account_type
disk_size_gb = var.os_disk_size
disk_encryption_set_id = var.enable_cmk_encryption ? azurerm_disk_encryption_set.linuxvm_disk_encryption[0].id : null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ variable "enable_cmk_encryption" {
variable "key_store_id" {
type = string
}
variable "os_disk_account_type" {
type = string
default = "Standard_LRS"
}
variable "os_disk_size" {
type = number
default = 64
}
12 changes: 12 additions & 0 deletions ...tes/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/parameters.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@
"source": {
"env": "KEY_STORE_ID"
}
},
{
"name": "os_disk_account_type",
"source": {
"env": "OS_DISK_ACCOUNT_TYPE"
}
},
{
"name": "os_disk_size",
"source": {
"env": "OS_DISK_SIZE"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ parameters:
- name: key_store_id
type: string
default: ""
- name: os_disk_account_type
type: string
default: "Standard_LRS"
description: "The type of storage account to use for the OS disk"
- name: os_disk_size
type: int
default: 128
description: "The size of the OS disk in GB"

outputs:
- name: ip
Expand Down Expand Up @@ -161,6 +169,8 @@ install:
image_gallery_id: ${ bundle.parameters.image_gallery_id }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
os_disk_account_type: ${ bundle.parameters.os_disk_account_type }
os_disk_size: ${ bundle.parameters.os_disk_size }
backendConfig:
use_azuread_auth: "true"
use_oidc: "true"
Expand Down Expand Up @@ -189,6 +199,8 @@ upgrade:
image_gallery_id: ${ bundle.parameters.image_gallery_id }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
os_disk_account_type: ${ bundle.parameters.os_disk_account_type }
os_disk_size: ${ bundle.parameters.os_disk_size }
backendConfig:
use_azuread_auth: "true"
use_oidc: "true"
Expand Down Expand Up @@ -229,6 +241,8 @@ uninstall:
image_gallery_id: ${ bundle.parameters.image_gallery_id }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
os_disk_account_type: ${ bundle.parameters.os_disk_account_type }
os_disk_size: ${ bundle.parameters.os_disk_size }
backendConfig:
use_azuread_auth: "true"
use_oidc: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"title": "Windows Virtual Machine",
"description": "Windows virtual machine.",
"required": [
"os_image",
"vm_size",
"os_disk_account_type",
"os_disk_size"
],
"authorizedRoles": [
"WorkspaceOwner", "WorkspaceResearcher"
Expand Down Expand Up @@ -40,6 +44,38 @@
"title": "Shared storage",
"default": true,
"description": "Enable access to shared storage"
},
"os_disk_account_type": {
"$id": "#/properties/os_disk_account_type",
"type": "string",
"title": "OS Disk Account Type",
"description": "The type of storage account to use for the OS disk",
"default": "Standard_LRS",
"enum": [
"Standard_LRS",
"Premium_LRS",
"StandardSSD_LRS",
"UltraSSD_LRS"
]
},
"os_disk_size": {
"$id": "#/properties/os_disk_size",
"type": "integer",
"title": "OS Disk Size",
"description": "The size of the OS disk in GB",
"default": 128,
"enum": [
64,
128,
256,
512,
1024,
2048,
4096,
8192,
16384,
32767
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ variable "enable_cmk_encryption" {
variable "key_store_id" {
type = string
}
variable "os_disk_account_type" {
type = string
default = "Standard_LRS"
}
variable "os_disk_size" {
type = number
default = 128
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ resource "azurerm_windows_virtual_machine" "windowsvm" {
os_disk {
name = "osdisk-${local.vm_name}"
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
storage_account_type = var.os_disk_account_type
disk_size_gb = var.os_disk_size
disk_encryption_set_id = var.enable_cmk_encryption ? azurerm_disk_encryption_set.windowsvm_disk_encryption[0].id : null
}

Expand Down

0 comments on commit e84d97b

Please sign in to comment.