Terraform-provider-azurerm: azurerm_virtual_machine_scale_set could not retrieve public IP addresses of the virtual machines in a scale set

Created on 31 Aug 2018  ·  4Comments  ·  Source: terraform-providers/terraform-provider-azurerm

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

public_ip_address_configuration offers public ip capability but could not get assigned public ips.

New or Affected Resource(s)

  • azurerm_virtual_machine_scale_set

Potential Terraform Configuration

// want get this outpu
output "vmss_public_ips" {
    value = ["${azurerm_virtual_machine_scale_set.vmss.public_ip_addresses}"]
}

// vmss creation : just like https://www.terraform.io/docs/providers/azurerm/r/virtual_machine_scale_set.html#public_ip_address_configuration
resource "azurerm_virtual_machine_scale_set" "vmss" {
  name                = "vmscaleset"
  location            = "West US 2"
  resource_group_name = "test"
  upgrade_policy_mode = "Manual"

  lifecycle {
    ignore_changes = ["sku"]
  }

  sku {
    name     = "Standard_F2"
    tier     = "Standard"
    capacity = 4
  }

  storage_profile_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"
  }

  storage_profile_os_disk {
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }

  storage_profile_data_disk {
    lun           = 0
    caching       = "ReadWrite"
    create_option = "Empty"
    disk_size_gb  = 10
  }

  os_profile {
    computer_name_prefix = "testvm"
    admin_username       = "myadmin"
    admin_password       = "Passwword1234"
  }

  os_profile_linux_config {
    disable_password_authentication = true

    ssh_keys {
      path     = "/home/myadmin/.ssh/authorized_keys"
      key_data = "${file("~/.ssh/demo_key.pub")}"
    }
  }

  network_profile {
    name    = "terraformnetworkprofile"
    primary = true

    ip_configuration {
      name                                   = "TestIPConfiguration"
      subnet_id                              = "${azurerm_subnet.test.id}"
      load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.bpepool.id}"]
      load_balancer_inbound_nat_rules_ids    = ["${element(azurerm_lb_nat_pool.lbnatpool.*.id, count.index)}"]

      public_ip_address_configuration {
        name              = "testvmss"
        idle_timeout      = 30
        domain_name_label = "testvmss"
      }
    }
  }
}

References

  • https://github.com/terraform-providers/terraform-provider-azurerm/issues/340

  • bug servicvmss

    Most helpful comment

    This issue has been fixed by the PR in issue #3763

    All 4 comments

    I have the same problem. I'm able to retrieve it using the Azure CLI but cannot find a Terraform native way.

    $ az vmss list-instance-public-ips -g civil-elk-test -n linux_challenges -o table
      IdleTimeoutInMinutes  IpAddress      Name    ProvisioningState    PublicIpAddressVersion    PublicIpAllocationMethod    ResourceGroup    ResourceGuid
    ----------------------  -------------  ------  -------------------  ------------------------  --------------------------  ---------------  ------------------------------------
                         5  52.x.x.x  asdf    Succeeded            IPv4                      Dynamic                     civil-elk-test   <redacted>
    

    This issue has been fixed by the PR in issue #3763

    This has been released in version 1.32.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

    provider "azurerm" {
        version = "~> 1.32.0"
    }
    # ... other configuration ...
    

    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 👉 [email protected]. Thanks!

    Was this page helpful?
    0 / 5 - 0 ratings