Skip to content

Commit c107df8

Browse files
committed
adding boot diagnostics to Linux scale set
1 parent 0a9ffbc commit c107df8

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

main.tf

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,25 @@ resource "azurerm_linux_virtual_machine_scale_set" "linux_vmss" {
325325
}
326326
}
327327

328-
automatic_instance_repair {
329-
enabled = var.enable_automatic_instance_repair
330-
grace_period = var.grace_period
328+
dynamic "automatic_instance_repair" {
329+
for_each = var.enable_automatic_instance_repair ? [1] : []
330+
content {
331+
enabled = var.enable_automatic_instance_repair
332+
grace_period = var.grace_period
333+
}
334+
}
335+
336+
dynamic "boot_diagnostics" {
337+
for_each = var.enable_boot_diagnostics ? [1] : []
338+
content {
339+
storage_account_uri = var.storage_account_name != null ? data.azurerm_storage_account.storeacc.0.primary_blob_endpoint : var.storage_account_uri
340+
}
341+
}
342+
343+
lifecycle {
344+
ignore_changes = [
345+
tags,
346+
]
331347
}
332348

333349
# As per the recomendation by Terraform documentation

variables.tf

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,17 +403,34 @@ variable "rolling_upgrade_policy" {
403403
}
404404
}
405405

406+
variable "enable_automatic_instance_repair" {
407+
description = "Should the automatic instance repair be enabled on this Virtual Machine Scale Set?"
408+
default = false
409+
}
410+
411+
412+
413+
variable "enable_boot_diagnostics" {
414+
description = "Should the boot diagnostics enabled?"
415+
default = false
416+
}
417+
418+
variable "storage_account_uri" {
419+
description = "The Primary/Secondary Endpoint for the Azure Storage Account which should be used to store Boot Diagnostics, including Console Output and Screenshots from the Hypervisor. Passing a `null` value will utilize a Managed Storage Account to store Boot Diagnostics."
420+
default = null
421+
}
422+
423+
424+
425+
406426
variable "license_type" {
407427
description = "Specifies the type of on-premise license which should be used for this Virtual Machine. Possible values are None, Windows_Client and Windows_Server."
408428
default = "None"
409429
}
410430

411431

412432

413-
variable "enable_automatic_instance_repair" {
414-
description = "Should the automatic instance repair be enabled on this Virtual Machine Scale Set?"
415-
default = false
416-
}
433+
417434

418435
variable "grace_period" {
419436
description = "Amount of time (in minutes, between 30 and 90, defaults to 30 minutes) for which automatic repairs will be delayed."

0 commit comments

Comments
 (0)