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

Terraform 0.7.0-dev built in vsphere network interface out of order #7673

Closed
pryorda opened this issue Jul 16, 2016 · 4 comments
Closed

Terraform 0.7.0-dev built in vsphere network interface out of order #7673

pryorda opened this issue Jul 16, 2016 · 4 comments

Comments

@pryorda
Copy link

pryorda commented Jul 16, 2016

Hi there,

TERRAFORM VERSION

Terraform 0.7.0-dev

Affected Resource(s)

vsphere instance -> network interface out of order.

Terraform Configuration Files

provider "vsphere" {
  user                 = "${var.vsphere_username}"
  password             = "${var.vsphere_password}"
  vsphere_server       = "${var.vsphere_server}"
  allow_unverified_ssl = "${var.vsphere_allow_unverified_ssl}"
}

resource "vsphere_folder" "simple_cluster" {
  path       = "${var.vsphere_folder_path}"
  datacenter = "${var.vsphere_datacenter}"
}

resource "vsphere_virtual_machine" "simple_cluster" {
  count        = "${var.cluster_size}"
  name         = "${lower(var.cluster_env)}-${lower(var.cluster_app)}${count.index + 1}"
  folder       = "${vsphere_folder.simple_cluster.path}"
  datacenter   = "${var.vsphere_datacenter}"
  cluster      = "${var.vsphere_cluster}"
  domain       = "${var.cluster_domain}"
  dns_servers  = ["${split(",",var.vsphere_network_domain_resolvers)}"]
  dns_suffixes = ["${split(",",var.vsphere_network_domain_search)}"]
  vcpu         = "${var.vsphere_vcpu}"
  memory       = "${var.vsphere_memory}"
  time_zone    = "${var.cluster_timezone}"

  network_interface {
    label              = "${var.vsphere_network_label}"
    ipv4_address       = "${element(split(",", var.vsphere_network_ipv4_addresses), count.index)}"
    ipv4_prefix_length = "${var.vsphere_network_ipv4_prefix_length}"
    ipv4_gateway       = "${var.vsphere_network_ipv4_gateway}"
  }

  network_interface {
    label              = "${var.vsphere_network_label_2}"
    ipv4_address       = "${element(split(",", var.vsphere_network_ipv4_addresses_2), count.index)}"
    ipv4_prefix_length = "${var.vsphere_network_ipv4_prefix_length_2}"
  }


  disk {
    datastore = "${var.vsphere_datastore}"
    template  = "${var.vsphere_template}"
    type      = "thin"
  }
}

Actual Behavior

Net interface became 0 instead of 1

Steps to Reproduce

  1. Create a vsphere instance with two nics. 2nd nic will take over as network_interface 0 instead of network interface 1.

tfstate data

                            "network_interface.#": "2",
                            "network_interface.0.adapter_type": "",
                            "network_interface.0.ip_address": "",
                            "network_interface.0.ipv4_address": "10.0.0.1",
                            "network_interface.0.ipv4_gateway": "",
                            "network_interface.0.ipv4_prefix_length": "24",
                            "network_interface.0.ipv6_address": "fe80::250:56ff:feb4:20c5",
                            "network_interface.0.ipv6_gateway": "",
                            "network_interface.0.ipv6_prefix_length": "64",
                            "network_interface.0.label": "Storage Network",
                            "network_interface.0.mac_address": "00:50:56:b4:20:c5",
                            "network_interface.0.subnet_mask": "",
                            "network_interface.1.adapter_type": "",
                            "network_interface.1.ip_address": "",
                            "network_interface.1.ipv4_address": "172.16.7.102",
                            "network_interface.1.ipv4_gateway": "",
                            "network_interface.1.ipv4_prefix_length": "24",
                            "network_interface.1.ipv6_address": "fe80::250:56ff:feb4:97e",
                            "network_interface.1.ipv6_gateway": "",
                            "network_interface.1.ipv6_prefix_length": "64",
                            "network_interface.1.label": "dvPortGroup_qa",
                            "network_interface.1.mac_address": "00:50:56:b4:09:7e",
                            "network_interface.1.subnet_mask": "",

Terraform output

  network_interface.#:                    "" => "2"
  network_interface.0.ip_address:         "" => "<computed>"
  network_interface.0.ipv4_address:       "" => "172.16.7.102"
  network_interface.0.ipv4_gateway:       "" => "172.16.7.1"
  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:              "" => "dvPortGroup_qa"
  network_interface.0.mac_address:        "" => "<computed>"
  network_interface.0.subnet_mask:        "" => "<computed>"
  network_interface.1.ip_address:         "" => "<computed>"
  network_interface.1.ipv4_address:       "" => "10.0.0.1"
  network_interface.1.ipv4_gateway:       "" => "<computed>"
  network_interface.1.ipv4_prefix_length: "" => "24"
  network_interface.1.ipv6_address:       "" => "<computed>"
  network_interface.1.ipv6_gateway:       "" => "<computed>"
  network_interface.1.ipv6_prefix_length: "" => "<computed>"
  network_interface.1.label:              "" => "Storage Network"
  network_interface.1.mac_address:        "" => "<computed>"
  network_interface.1.subnet_mask:        "" => "<computed>"
@pryorda pryorda changed the title Terraform 0.7.0-dev built in vsphere issue Terraform 0.7.0-dev built in vsphere network interface out of order Jul 16, 2016
@pryorda
Copy link
Author

pryorda commented Jul 20, 2016

Update this appears to be just bug in the way it builds the tfstate. The interfaces in the virtual machine are correct.

The remote exec should go against 172.x.x.x but instead its going against

module.operations_requirements.null_resource.base: Creating...
  triggers.%:         "" => "1"
  triggers.this_uuid: "" => "23eae6b1-a8cb-d1d2-bdd0-929a957eb09d"
module.operations_requirements.null_resource.base: Provisioning with 'remote-exec'...
module.operations_requirements.null_resource.base (remote-exec): Connecting to remote host via SSH...
module.operations_requirements.null_resource.base (remote-exec):   Host: 10.0.0.1
module.operations_requirements.null_resource.base (remote-exec):   User: ubuntu
module.operations_requirements.null_resource.base (remote-exec):   Password: false
module.operations_requirements.null_resource.base (remote-exec):   Private key: true
module.operations_requirements.null_resource.base (remote-exec):   SSH Agent: true
module.operations_requirements.null_resource.base: Still creating... (10s elapsed)

@pryorda
Copy link
Author

pryorda commented Jul 20, 2016

More fun caused by these being out of order

+ module.provider_cluster.vsphere_virtual_machine.simple_cluster
    cluster:                                "VMSAC02 Cluster" => "VMSAC02 Cluster"
    datacenter:                             "Sacramento-" => "Sacramento-"
    disk.#:                                 "1" => "1"
    disk.2709387932.bootable:               "false" => ""
    disk.2709387932.controller_type:        "scsi" => "scsi"
    disk.2709387932.datastore:              "Nimble Datastores/qaex" => "Nimble Datastores/qaex"
    disk.2709387932.iops:                   "0" => ""
    disk.2709387932.keep_on_remove:         "false" => ""
    disk.2709387932.key:                    "0" => "<computed>"
    disk.2709387932.name:                   "" => ""
    disk.2709387932.size:                   "0" => ""
    disk.2709387932.template:               "Templates/Ubuntu-Trusty-14.04.4_40G" => "Templates/Ubuntu-Trusty-14.04.4_40G"
    disk.2709387932.type:                   "thin" => "thin"
    disk.2709387932.uuid:                   "" => "<computed>"
    disk.2709387932.vmdk:                   "" => ""
    dns_servers.#:                          "2" => "2"
    dns_servers.0:                          "172.16.0.8" => "172.16.0.8"
    dns_servers.1:                          "172.16.40.8" => "172.16.40.8"
    dns_suffixes.#:                         "2" => "2"
    dns_suffixes.0:                         "int.xxx.com" => "int.xxx.com"
    dns_suffixes.1:                         "xxx.com" => "xxx.com"
    domain:                                 "int.xxx.com" => "int.xxx.com"
    enable_disk_uuid:                       "false" => "false"
    folder:                                 "QA/QAEX" => "QA/QAEX"
    linked_clone:                           "false" => "false"
    memory:                                 "4096" => "4096"
    memory_reservation:                     "0" => "0"
    name:                                   "qaex-afile1" => "qaex-afile1"
    network_interface.#:                    "2" => "2"
    network_interface.0.ip_address:         "" => "<computed>"
    network_interface.0.ipv4_address:       "10.0.0.1" => "172.16.7.102"
    network_interface.0.ipv4_gateway:       "" => "172.16.7.1"
    network_interface.0.ipv4_prefix_length: "24" => "24"
    network_interface.0.ipv6_address:       "fe80::250:56ff:feb4:fc74" => "<computed>"
    network_interface.0.ipv6_gateway:       "" => "<computed>"
    network_interface.0.ipv6_prefix_length: "64" => "<computed>"
    network_interface.0.label:              "Storage Network" => "dvPortGroup_qa" (forces new resource)
    network_interface.0.mac_address:        "00:50:56:b4:fc:74" => "<computed>"
    network_interface.0.subnet_mask:        "" => "<computed>"
    network_interface.1.ip_address:         "" => "<computed>"
    network_interface.1.ipv4_address:       "172.16.7.102" => "10.0.0.1"
    network_interface.1.ipv4_gateway:       "" => "<computed>"
    network_interface.1.ipv4_prefix_length: "24" => "24"
    network_interface.1.ipv6_address:       "fe80::250:56ff:feb4:d1c3" => "<computed>"
    network_interface.1.ipv6_gateway:       "" => "<computed>"
    network_interface.1.ipv6_prefix_length: "64" => "<computed>"
    network_interface.1.label:              "dvPortGroup_qa" => "Storage Network" (forces new resource)
    network_interface.1.mac_address:        "00:50:56:b4:d1:c3" => "<computed>"
    network_interface.1.subnet_mask:        "" => "<computed>"
    skip_customization:                     "false" => "false"
    time_zone:                              "America/Los_Angeles" => "America/Los_Angeles"
    vcpu:                                   "2" => "2"

@pryorda
Copy link
Author

pryorda commented Jul 20, 2016

Closing this as PR: #7154 should fix this.

@ghost
Copy link

ghost commented Apr 10, 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 10, 2020
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