Error: Unsupported block type error while configuring azure virtual machine

I am getting below error while configuring virtual machine. I followed the terraform docs & trying to configure the vm. Below is my code & error which i am getting. Any help would be appreciated.

resource “azurerm_virtual_machine” “web_server” {

name = “${var.web_server_name }-vm”

location = var.web_server_location

resource_group_name = azurerm_resource_group.web_server_rg.name

network_interface_ids = [azurerm_network_interface.web_server_nic.id]

vm_size = “Standard_B1s”

}

storage_image_reference {

publisher = "MicrosoftWindowsServer"

offer     = "WindowsServer"

sku       = "2016-Datacenter-Server-Core-smalldisk"

version   = "latest"

}

os_profile {

computer_name = “${var.web_server_name}”

admin_username = “testadmin”

admin_password = “Password1234!”

}

PS D:\Terraform> terraform plan

Error: Unsupported block type

on main.tf line 100:
100: storage_image_reference {

Blocks of type “storage_image_reference” are not expected here.

Error: Unsupported block type

on main.tf line 106:
106: os_profile {

Blocks of type “os_profile” are not expected here.

Your braces are not correctly placed.
resource “azurerm_virtual_machine” “web_server” {
closing brace should be at the end.

Got that. Thanks :+1:

1 Like