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

[WIP] provider/vsphere: reliable network interface indices #7154

Closed
wants to merge 3 commits into from
Closed

[WIP] provider/vsphere: reliable network interface indices #7154

wants to merge 3 commits into from

Conversation

thetuxkeeper
Copy link
Contributor

Before implementing the update of the network interfaces, we need a reliable way to match the config and the devices in VMware.
This is a WIP since I have problems getting the data into the TF schema object structure.
I want a map[string]map[string] structure. The outer map with the device id/device key as index and the inner map like the current structure with ip addresses, gateway,...
Is there a way to override the hash function of the TypeSet ? With TypeMap I get an error at runtime (will add the message later), but the core message was that it was an invalid input for the schema object.
cc @chrislovecnm

@tommynsong
Copy link

tommynsong commented Jun 21, 2016

@thetuxkeeper i have merge your PR into my develop branch at https://github.com/tommynsong/terraform/tree/develop, but there seems to be issue with planning multiple network_interface.

Here is the resource declaration:

resource "vsphere_virtual_machine" "web" {
  name          = "web-web"
  domain        = "domain.local"
  vcpu          = 2
  memory        = 4096
  datacenter    = "DC"
  cluster       = "test-cluster"
  host_system   = "esx1.domain.local"
  folder        = "SandboxS"
  dns_servers   = ["192.168.32.140", "192.168.33.140"]

  network_interface {
    label               = "mgmt"
    ipv4_address        = "192.168.33.21"
    ipv4_gateway        = "192.168.32.1"
    ipv4_prefix_length  = "22"
  }

  network_interface {
    label               = "nids"
    ipv4_address        = "169.254.64.2"
    ipv4_prefix_length  = "24"
  }

  disk {
    datastore = "Datastore1"
    template  = "Templates/CENTOS-7.1"
    type      = "thin"
    bootable  = true
  }
}

And here is the output of the terraform plan:

+ vsphere_virtual_machine.web
    cluster:                                "test-cluster"
    datacenter:                             "DC"
    disk.#:                                 "1"
    disk.3328003716.bootable:               "true"
    disk.3328003716.controller_type:        "scsi"
    disk.3328003716.datastore:              "Datastore1"
    disk.3328003716.iops:                   ""
    disk.3328003716.keep_on_remove:         ""
    disk.3328003716.key:                    "<computed>"
    disk.3328003716.name:                   ""
    disk.3328003716.size:                   ""
    disk.3328003716.template:               "Templates/CENTOS-7.1"
    disk.3328003716.type:                   "thin"
    disk.3328003716.uuid:                   "<computed>"
    disk.3328003716.vmdk:                   ""
    dns_servers.#:                          "2"
    dns_servers.0:                          "192.168.32.140"
    dns_servers.1:                          "192.168.33.140"
    domain:                                 "domain.local"
    enable_disk_uuid:                       "false"
    folder:                                 "SandboxS"
    host_system:                            "esx1.domain.local"
    linked_clone:                           "false"
    memory:                                 "4096"
    memory_reservation:                     "0"
    name:                                   "web-web"
    network_interface.#:                    "1"
    network_interface.0.adapter_type:       ""
    network_interface.0.device_key:         "<computed>"
    network_interface.0.ip_address:         "<computed>"
    network_interface.0.ipv4_address:       "169.254.64.2"
    network_interface.0.ipv4_gateway:       "<computed>"
    network_interface.0.ipv4_prefix_length: "24"
    network_interface.0.ipv6_address:       "<computed>"
    network_interface.0.ipv6_gateway:       "<computed>"
    network_interface.0.ipv6_prefix_length: "<computed>"
    network_interface.0.label:              "nids"
    network_interface.0.mac_address:        "<computed>"
    network_interface.0.subnet_mask:        "<computed>"
    skip_customization:                     "false"
    time_zone:                              "Etc/UTC"
    vcpu:                                   "2"


Plan: 1 to add, 0 to change, 0 to destroy.

@thetuxkeeper
Copy link
Contributor Author

Thank you for testing it! :)
I'm having some trouble with the schema object and how to use it that it works like I want. Perhaps that's the source of the problem (overwriting indices, ...). It needs some more work :)
I don't have too much time for it, so I will take a look at it next week again.

@tommynsong
Copy link

@thetuxkeeper just want to point out that this issue seem to (in my current testing) affect CentOS 7 with open-vm-tools 9.10.2.48224 (build-2822639) .
I have tested with Ubuntu 16.04 with open-vm-tools 10.0.7.52125 (build-3227872) and the order of the vNICs remain intact.

@chrislovecnm
Copy link
Contributor

chrislovecnm commented Jun 23, 2016

@tommynsong does that version of centos7 open-vm-tools require the deploypkg?

@tommynsong
Copy link

@pryorda
Copy link

pryorda commented Jul 20, 2016

Is this still a WIP or is it ready to be merged?

@thetuxkeeper
Copy link
Contributor Author

thetuxkeeper commented Jul 22, 2016

@pryorda : Sorry, it's not ready. I haven't found the time to continue.
I stopped at the point where I couldn't figure out how to put in predefined/self-generated indexes into the terraform schema. A "Set" seems to support custom indexing-functions, but I couldn't get it work in time. I wanted to use the device id from vmware/govmomi as index in the terraform schema.

@pryorda
Copy link

pryorda commented Jul 23, 2016

I found that vmware just reverses the order with getting guest.net info. I have a pull request to to just reverse it on the virtual machine read in the provider.

@tommynsong
Copy link

@pryorda if the issue is at govmomi, would it makes more sense to create a PR to VMware instead?
I'm just afraid that once VMware fix their guest.net info, we would come back here and undo the changes.

@pryorda
Copy link

pryorda commented Jul 24, 2016

From what i could tell, it is vmwares api. You are correct if vmware decides this is a bug we would have to come back.

Sent from my Verizon, Samsung Galaxy smartphone
-------- Original message --------From: Tommy Song [email protected] Date: 7/23/16 6:18 PM (GMT-07:00) To: hashicorp/terraform [email protected] Cc: Daniel Pryor [email protected], Mention [email protected] Subject: Re: [hashicorp/terraform] [WIP] provider/vsphere: reliable network interface indices (#7154)
@pryorda if the issue is at govmomi, would it makes more sense to create a PR to VMware instead?

I'm just afraid that once VMware fix their guest.net info, we would come back here and undo the changes.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@sherzberg
Copy link

Any progress on this? We are running into this issue as well.

@mkrakowitzer
Copy link

Same issue here.

@sbourlon
Copy link

I have the same issue as well with Terraform v0.7.7.

@ghost
Copy link

ghost commented Jan 24, 2017

Any progress? This issue exists in v0.7.0-v0.8.4

@thetuxkeeper
Copy link
Contributor Author

Sorry, I don't think there will be any progress from my side. Don't have time to work on it and we barely use terraform at the moment (no changes to the part terraform is responsible of).
Also there's a fix available by @pryorda: #7760
If someone wants to continue what I started, you can contact me.
I'm closing this PR.

@ghost
Copy link

ghost commented Apr 17, 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 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.

@ghost ghost locked and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants