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

Data Source Public IP failed if dynamic IP is not allocated #2440

Closed
appelgriebsch opened this issue Dec 4, 2018 · 1 comment
Closed

Data Source Public IP failed if dynamic IP is not allocated #2440

appelgriebsch opened this issue Dec 4, 2018 · 1 comment

Comments

@appelgriebsch
Copy link

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

Terraform (and AzureRM Provider) Version

Terraform v0.11.10

  • provider.azurerm v1.19.0

Affected Resource(s)

  • data.azurerm_public_ip

Terraform Configuration Files

data "azurerm_public_ip" "pubip" {
  name                = "${var.name}"
  resource_group_name = "${var.resource_group["name"]}"
}
output "instance" {
  value = {
    id          = "${data.azurerm_public_ip.pubip.id}"
    name        = "${data.azurerm_public_ip.pubip.name}"
    fqdn        = "${data.azurerm_public_ip.pubip.fqdn}"
    domain_name = "${data.azurerm_public_ip.pubip.domain_name_label}"
    ip_address  = "${data.azurerm_public_ip.pubip.ip_address}"
  }
}

Expected Behavior

Terraform apply will dump out the information on the public ip resource found in Azure.

Actual Behavior

If the public ip address is of type "dynamic" and is not associated with a network device the query will fail. Terraform plan will complain that the attributes fqdn, domain_name and ip_address are not known.

The Terraform state only has:

module.test-find-publicip2.data.azurerm_public_ip.pubip:
  id = /subscriptions/XXXXX/resourceGroups/AppServicesDev/providers/Microsoft.Network/publicIPAddresses/dev-ip2
  idle_timeout_in_minutes = 4
  ip_version = IPv4
  name = dev-ip2
  resource_group_name = AppServicesDev
  tags.% = 0

If on the other hand the "dynamic" ip address is assigned to a network device accordingly, it will properly display all the information.

The Terraform state shows:

module.test-find-publicip.data.azurerm_public_ip.pubip:
  id = /subscriptions/XXXX/resourceGroups/AppServicesDev/providers/Microsoft.Network/publicIPAddresses/dev-ip
  domain_name_label = <xyz>
  fqdn = <xyz>.westeurope.cloudapp.azure.com
  idle_timeout_in_minutes = 4
  ip_address = <an IPv4 address>
  ip_version = IPv4
  name = dev-ip
  resource_group_name = AppServicesDev
  tags.% = 0

There is no way currently to check for the existence of the attributes in HCL to manage the output. There is no attribute to signal the status of a dynamically assigned public ip that can eventually used in a condition statement.

@ghost
Copy link

ghost commented Mar 5, 2019

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 5, 2019
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

3 participants