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

wait_for_ips and ip_addresses does not distinguish between IPv4/6 #249

Open
japicken opened this issue Feb 23, 2024 · 0 comments
Open

wait_for_ips and ip_addresses does not distinguish between IPv4/6 #249

japicken opened this issue Feb 23, 2024 · 0 comments

Comments

@japicken
Copy link

Terraform Version

1.7.1

Affected Resource(s)

  • hyperv_machine_instance
  • hyperv_machine_instance.network_adaptors

Terraform Configuration Files

resource "hyperv_machine_instance" "vm" {
  ...

  dynamic "network_adaptors" {
    for_each = var.vm_instance.hyperv.network_adaptors

    content {
      name                     = try(network_adaptors.value.name, null)
      switch_name              = try(network_adaptors.value.switch_name, "")
      dynamic_mac_address      = try(network_adaptors.value.dynamic_mac_address, null)
      static_mac_address       = try(network_adaptors.value.static_mac_address, null)
      mac_address_spoofing     = try(network_adaptors.value.mac_address_spoofing ? "On" : "Off", "Off")
      vlan_access              = try(network_adaptors.value.vlan_access, true)
      vlan_id                  = try(network_adaptors.value.vlan_id, 392)
      vrss_enabled             = try(network_adaptors.value.vrss_enabled, null)
      vmmq_enabled             = try(network_adaptors.value.vmmq_enabled, null)
      wait_for_ips             = try(network_adaptors.value.wait_for_ips, false)
      iov_weight               = try(network_adaptors.value.iov_weight, 0)
      port_mirroring           = "None"
    }
  }

  connection {
    type     = var.vm_instance.ansible.communication_method
    port     = lookup({ winrm = 5986, ssh = 22 }, var.vm_instance.ansible.communication_method, null)
    user     = var.vm_instance.connection_username
    password = var.vm_instance.connection_password
    host     = self.network_adaptors[0].ip_addresses[0]
    https    = var.vm_instance.ansible.communication_method == "winrm" ? true : null
    insecure = var.vm_instance.ansible.communication_method == "winrm" ? true : null
    use_ntlm = var.vm_instance.ansible.communication_method == "winrm" ? true : null
    timeout  = try(var.vm_instance.ansible.initial_connection_timeout, "30m")
  }
  ...
}

Enhancement Request

This is an enhancement request, apologies if is this is not the correct way to submit one. We have a problem where sometimes self.network_adaptors[0].ip_addesses[0] contains an IPv6 address, and what we're really wanting is an IPv4 address. If there were a wait_for_ipv4 and a separate wait_for_ipv6, then maybe in addition to ip_addresses if we had an ipv4_addresses and an ipv6_addresses this would solve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants