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 - private ip not visible when assigned dynamically #6549

Closed
ghost opened this issue May 9, 2016 · 5 comments
Closed

azurerm - private ip not visible when assigned dynamically #6549

ghost opened this issue May 9, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented May 9, 2016

Terraform Version

v0.6.15

Affected Resource(s)

azurerm_network_interface

Terraform Configuration Files

resource "azurerm_resource_group" "test" {
  name     = "acctestrg"
  location = "West US"
}

resource "azurerm_virtual_network" "test" {
  name                = "acctvn"
  address_space       = ["10.0.0.0/16"]
  location            = "West US"
  resource_group_name = "${azurerm_resource_group.test.name}"
}

resource "azurerm_subnet" "test" {
  name                 = "acctsub"
  resource_group_name  = "${azurerm_resource_group.test.name}"
  virtual_network_name = "${azurerm_virtual_network.test.name}"
  address_prefix       = "10.0.2.0/24"
}

resource "azurerm_network_interface" "test" {
  name                = "acctni"
  location            = "West US"
  resource_group_name = "${azurerm_resource_group.test.name}"

  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = "${azurerm_subnet.test.id}"
    private_ip_address_allocation = "dynamic"
  }
}

resource "azurerm_storage_account" "test" {
  name                = "hashicorpaccsa"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "westus"
  account_type        = "Standard_LRS"

  tags {
    environment = "staging"
  }
}

resource "azurerm_storage_container" "test" {
  name                  = "vhds"
  resource_group_name   = "${azurerm_resource_group.test.name}"
  storage_account_name  = "${azurerm_storage_account.test.name}"
  container_access_type = "private"
}

resource "azurerm_virtual_machine" "test" {
  name                  = "acctvm"
  location              = "West US"
  resource_group_name   = "${azurerm_resource_group.test.name}"
  network_interface_ids = ["${azurerm_network_interface.test.id}"]
  vm_size               = "Standard_A0"

  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "14.04.2-LTS"
    version   = "latest"
  }

  storage_os_disk {
    name          = "myosdisk1"
    vhd_uri       = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/myosdisk1.vhd"
    caching       = "ReadWrite"
    create_option = "FromImage"
  }

  os_profile {
    computer_name  = "hostname"
    admin_username = "testadmin"
    admin_password = "Password1234!"
  }

  os_profile_linux_config {
    disable_password_authentication = false
  }
}

Expected Behavior

When the VM is provisioned, through the web portal a private IP is displayed - dynamically allocated within the subnet range. I'm unable to access this IP for use in further modules of my TF script. When I run terraform show, i can see the following:

azurerm_network_interface.test:
id = /subscriptions/XXX/resourceGroups/acctestrg/providers/Microsoft.Network/networkInterfaces/acctni
applied_dns_servers.# = 0
dns_servers.# = 0
ip_configuration.# = 1
ip_configuration.2194851273.load_balancer_backend_address_pools_ids.# = 0
ip_configuration.2194851273.load_balancer_inbound_nat_rules_ids.# = 0
ip_configuration.2194851273.name = testconfiguration1
ip_configuration.2194851273.private_ip_address =
ip_configuration.2194851273.private_ip_address_allocation = dynamic
ip_configuration.2194851273.public_ip_address_id =
ip_configuration.2194851273.subnet_id = /subscriptions/XXX/resourceGroups/acctestrg/providers/Microsoft.Network/virtualNetworks/acctvn/subnets/acctsub
location = westus
name = acctni
resource_group_name = acctestrg
tags.# = 0

Actual Behavior

No method of retrieving the private IP.

@stack72
Copy link
Contributor

stack72 commented May 9, 2016

Hi @Tasquith

Luckily, there is a PR open to fix this :) #6538

I am hopeful this will make the 0.6.16 release

P.

ps. just a FYI, i edited your issue description for layout

@ghost
Copy link
Author

ghost commented May 9, 2016

Cheers Paul,

Is there an ETA for the 0.6.16 release?

Thanks again for your help!

Tom

@stack72
Copy link
Contributor

stack72 commented May 9, 2016

@Tasquith I believe in the next day or 2 :)

@stack72
Copy link
Contributor

stack72 commented May 9, 2016

Hi @Tasquith

this has now been fixes with #6538 :)

P.

@stack72 stack72 closed this as completed May 9, 2016
@github-actions
Copy link

github-actions bot commented Jun 3, 2021

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 Jun 3, 2021
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

1 participant