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

azurerm_virtual_machine requires an admin_password when disable_password_authentication is set #152

Closed
DWSR opened this issue Jul 4, 2017 · 2 comments · Fixed by #154
Closed
Assignees
Labels

Comments

@DWSR
Copy link

DWSR commented Jul 4, 2017

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

0.9.8

Affected Resource(s)

azurerm_virtual_machine

Terraform Configuration Files

resource "azurerm_virtual_machine" "vm" {
  name                  = "${var.name}-vm"
  location              = "${var.location}"
  resource_group_name   = "${var.resourcegroup}"
  network_interface_ids = [ "${azurerm_network_interface.vm.id}" ]
  vm_size               = "${var.size}"

  storage_image_reference = ["${var.image_reference[var.os]}"]

  storage_os_disk {
    name              = "${var.name}-osdisk"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "${var.storagetype}"
    disk_size_gb      = "${var.osdisksize}"
  }

  os_profile {
    computer_name  = "${var.name}"
    admin_username = "${var.adminusername}"
    admin_password = "${random_id.adminpassword.hex}"
  }

  os_profile_linux_config {
    disable_password_authentication = 1

    ssh_keys {
      path     = "/home/${var.adminusername}/.ssh/authorized_keys"
      key_data = "${var.sshkey}"
    }
  }
}

resource "azurerm_network_interface" "vm" {
  name                = "${var.name}-nic"
  resource_group_name = "${var.resourcegroup}"
  location            = "${var.location}"

  ip_configuration = {
    name                          = "${var.name}-ipconfig"
    subnet_id                     = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/resourceGroups/${var.resourcegroup}/providers/Microsoft.Network/virtualNetworks/${var.vnet}/subnets/${var.subnet}"
    private_ip_address_allocation = "dynamic"
    public_ip_address_id          = "${azurerm_public_ip.vm.id}"
  }
}

resource "azurerm_public_ip" "vm" {
  count                        = "${var.create_pip}"
  name                         = "${var.name}-pip"
  location                     = "${var.location}"
  resource_group_name          = "${var.resourcegroup}"
  public_ip_address_allocation = "dynamic"
}

Expected Behavior

Terraform should not require an admin password when specifying disable_password_authentication = 1

Actual Behavior

Terraform requires an admin password when specifying disable_password_authentication = 1

@tombuildsstuff
Copy link
Contributor

Hey @DWSR

Thanks for opening this issue :)

Taking a quick look at the API documentation, it appears the API supports this so this is a Terraform bug. As such I've opened PR #154 which includes a fix for this :)

Thanks!

@ghost
Copy link

ghost commented Apr 1, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants