Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archmangler/4f99d94c230dfe7f01a8e6997f9a7eb9 to your computer and use it in GitHub Desktop.
Save archmangler/4f99d94c230dfe7f01a8e6997f9a7eb9 to your computer and use it in GitHub Desktop.
terraform azure boot_diagnostics
Terraform Example of using boot_diagnostics for Azure virtual Machine
=====================================================================
- include this in the vm resource bloc:
```
.
.
.
boot_diagnostics {
enabled = "true"
storage_uri = "${azurerm_storage_account.diagstorage2.primary_blob_endpoint}"
}
.
.
.
```
- will need to define a boot diagnostics sa type:
```
variable "boot_diagnostics_sa_type" {
description = "(Optional) Storage account type for boot diagnostics"
default = "Standard_LRS"
}
```
- create a storage account
```
/*Create a storage account to create blob storage for the boot diag output*/
resource "azurerm_storage_account" "main" {
name = "bootdiag20092018001"
resource_group_name = "${azurerm_resource_group.main.name}"
location = "${azurerm_resource_group.main.location}"
account_tier = "${element(split("_", var.boot_diagnostics_sa_type),0)}"
account_replication_type = "${element(split("_", var.boot_diagnostics_sa_type),1)}"
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment