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

internal_fqdn attribute for network interfaces not exported #968

Closed
pdeva opened this issue Mar 13, 2018 · 3 comments · Fixed by #977
Closed

internal_fqdn attribute for network interfaces not exported #968

pdeva opened this issue Mar 13, 2018 · 3 comments · Fixed by #977

Comments

@pdeva
Copy link

pdeva commented Mar 13, 2018

Terraform Version

Terraform v0.11.3

  • provider.azurerm v1.2.0

Affected Resource(s)

  • azurerm_network_interface

Terraform Configuration Files

resource "azurerm_network_interface" "ni" {
  count = "${var.icount}"
  name                = "${var.instance_name}-${count.index}"
  location            = "${var.location}"
  resource_group_name = "${var.rg_name}"
  network_security_group_id = "${azurerm_network_security_group.nsg.id}"

  ip_configuration {
    name                          = "${var.instance_name}"
    subnet_id                     = "${var.subnet_id}"
    private_ip_address_allocation = "dynamic"
    public_ip_address_id = "${element(azurerm_public_ip.pubIp.*.id, count.index)}"
  }
}

output "fqdn" {
  value = ["${azurerm_network_interface.ni.*.internal_fqdn}"]
}

Expected Behavior

Should return the internal fqdn without errors

Actual Behavior

Error msg, like this:

 module.dev-kafka.output.fqdn: Resource 'azurerm_network_interface.ni' does not have attribute 'internal_fqdn' for variable 'azurerm_network_interface.ni.*.internal_fqdn'

looked at the terraform state file and internal_fqdn isnt stored there either

Steps to Reproduce

Create a network interface with >0 count and try to extract its internal_fqdn attribute in an output

@tombuildsstuff
Copy link
Contributor

hey @pdeva

Thanks for opening this issue

Taking a look into this, this value is only set if there's an actual value assigned for this key (I'll send a PR to default this to an empty string if nothing's specified). As such I can confirm that when specifying internal_fqdn this field is passed to Azure and returned in the state - would you be able to take a look and see if that resolves your issue here? Here's the configuration I'm referencing used:

resource "azurerm_resource_group" "test" {
  name     = "tharvey-devrg"
  location = "West Europe"
}

resource "azurerm_virtual_network" "test" {
  name                = "acctestvn-tom"
  address_space       = ["10.0.0.0/16"]
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
}

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

resource "azurerm_network_interface" "test" {
  name                = "acctestni-tom"
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"

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

  internal_fqdn = "hi"
}

Given this is a question about the configuration rather than a bug in Terraform - I'm going to close this issue for the moment.

Thanks!

@TraGicCode
Copy link

@tombuildsstuff I don't understand why you have to set this when azure knows it under the hood. Is this an issue with azure not making it queryable?

@ghost
Copy link

ghost commented Mar 31, 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 Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants