Skip to content

Commit

Permalink
Merge pull request #15 from Ontotext-AD/TES-330_update_premium_v2
Browse files Browse the repository at this point in the history
TES-330 Updated the disks to PremiumSSD_v2
  • Loading branch information
viktor-ribchev authored Nov 21, 2023
2 parents 61843da + 441a86b commit efb6039
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ module "vm" {
# Configurations for the user data script
graphdb_external_address_fqdn = module.address.public_ip_address_fqdn
key_vault_name = module.vault.key_vault_name
data_disk_performance_tier = var.data_disk_performance_tier
disk_size_gb = var.disk_size_gb

disk_iops_read_write = var.disk_iops_read_write
disk_mbps_read_write = var.disk_mbps_read_write
disk_size_gb = var.disk_size_gb

instance_type = var.instance_type
image_id = module.graphdb_image.image_id
Expand Down
3 changes: 2 additions & 1 deletion modules/vm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ locals {
user_data_script = var.custom_user_data != null ? var.custom_user_data : templatefile("${path.module}/templates/entrypoint.sh.tpl", {
graphdb_external_address_fqdn : var.graphdb_external_address_fqdn
key_vault_name : var.key_vault_name
data_disk_performance_tier : var.data_disk_performance_tier
disk_iops_read_write : var.disk_iops_read_write
disk_mbps_read_write : var.disk_mbps_read_write
disk_size_gb : var.disk_size_gb
})
}
Expand Down
15 changes: 11 additions & 4 deletions modules/vm/templates/entrypoint.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ REGION_ID=$(az vmss list-instances --resource-group $RESOURSE_GROUP --name $VMSS
# Do NOT change the LUN. Based on this we find and mount the disk in the VM
LUN=2

TIER=${data_disk_performance_tier}
DISK_IOPS=${disk_iops_read_write}
DISK_THROUGHPUT=${disk_mbps_read_write}
DISK_SIZE_GB=${disk_size_gb}

# TODO Define the disk name based on the hostname ??
Expand All @@ -50,7 +51,15 @@ done

if [ -z "$existingUnattachedDisk" ]; then
echo "Creating a new managed disk"
az disk create --resource-group $RESOURSE_GROUP --name $diskName --size-gb $DISK_SIZE_GB --location $REGION_ID --sku Premium_LRS --zone $ZONE_ID --tier $TIER
az disk create --resource-group $RESOURSE_GROUP \
--name $diskName \
--size-gb $DISK_SIZE_GB \
--location $REGION_ID \
--sku PremiumV2_LRS \
--zone $ZONE_ID \
--os-type Linux \
--disk-iops-read-write $DISK_IOPS \
--disk-mbps-read-write $DISK_THROUGHPUT
fi

# Checks if a managed disk is attached to the instance
Expand Down Expand Up @@ -179,8 +188,6 @@ if [[ $secrets == *"graphdb-java-options"* ]]; then
)
fi

# TODO: -Xmx based on the machine's memory size

# TODO: Backup cron

# TODO: Monitoring/instrumenting
Expand Down
12 changes: 9 additions & 3 deletions modules/vm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,14 @@ variable "disk_size_gb" {
default = null
}

variable "data_disk_performance_tier" {
description = "Performance tier of the managed data disk"
type = string
variable "disk_iops_read_write" {
description = "Data disk IOPS"
type = number
default = null
}

variable "disk_mbps_read_write" {
description = "Data disk throughput"
type = number
default = null
}
18 changes: 14 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,28 @@ variable "custom_graphdb_vm_user_data" {
default = null
}

# Data disks

variable "disk_size_gb" {
description = "Size of the managed data disk which will be created"
type = number
default = 500
}

variable "data_disk_performance_tier" {
description = "Performance tier of the managed data disk"
type = string
default = "P40"
variable "disk_iops_read_write" {
description = "Data disk IOPS"
type = number
default = 7500
}

variable "disk_mbps_read_write" {
description = "Data disk throughput"
type = number
default = 250
}

# Bastion

variable "deploy_bastion" {
description = "Deploy bastion module"
type = bool
Expand Down

0 comments on commit efb6039

Please sign in to comment.