Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get boot_diagnostics enabled since boot_diagnostics block seems NOT support "enabled=true" #13023

Closed
gkzz opened this issue Aug 17, 2021 · 3 comments

Comments

@gkzz
Copy link

gkzz commented Aug 17, 2021

Terraform Version

Terraform v1.0.0

Terraform Configuration Files

resource "azurerm_linux_virtual_machine" "main" {
  name                = "tf-vm"
  resource_group_name = azurerm_resource_group.main.name
  location            = azurerm_resource_group.main.location
  size                = "Standard_F2"
  admin_username      = "admin_user"
  network_interface_ids = [
    azurerm_network_interface.main.id,
  ]

  boot_diagnostics {
        ## DOES ANYONE KNOW HOW TO FIX IT??
        enabled = "true"
        storage_account_uri = azurerm_storage_account.main.primary_blob_endpoint
  }
}

resource "random_id" "main" {
    keepers = {
        # Generate a new ID only when a new resource group is defined
        resource_group = azurerm_resource_group.main.name
    }

    byte_length = 8
}

resource "azurerm_storage_account" "main" {
    name                        = "diag${random_id.main.hex}"
    location            = azurerm_resource_group.main.location
    resource_group_name         = azurerm_resource_group.main.name
    account_replication_type    = "LRS"
    account_tier                = "Standard"

    tags = {
        environment = "dev"
    }
}

Ref: https://github.com/gkzz/azure-provider-terraform-linux/blob/main/main.tf

Debug Output

$ terraform plan
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 99, in resource "azurerm_linux_virtual_machine" "main":
│   99:         enabled = "true"
│ 
│ An argument named "enabled" is not expected here.
╵
$ 
$ terraform apply
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 99, in resource "azurerm_linux_virtual_machine" "main":
│   99:         enabled = "true"
│ 
│ An argument named "enabled" is not expected here.
╵
$

Expected Behavior

Both of terraform plan and terraform apply work as usual

References

  • The following Azure document says
    • Enable managed boot diagnostics using Azure Resource Manager (ARM) templates

 "diagnosticsProfile": {
     "bootDiagnostics": {
         "enabled": true
      }
 }

Ref: https://docs.microsoft.com/en-us/azure/virtual-machines/boot-diagnostics#enable-managed-boot-diagnostics-using-azure-resource-manager-arm-templates

  • The following Terraform document also mentions

    • A boot_diagnostics block supports the following:

      ・enabled - (Required) ty

      ・storage_uri - (Required) The Storage Account's Blob Endpoint which should hold the virtual machine's diagnostic files.

Ref: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine

@martinbjorgan
Copy link
Contributor

I belive the enabled flag has been removed from the linux and windows virtual machine resource.
To enable boot diagnostics you set the boot_diagnostics block and give in the storage_account_uri. If you pass in a null value a Managed Storage Account will be used to store boot diagnostics.

@aslafy-z
Copy link
Contributor

This issue can be closed.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants