From 0a44aad0f633c56cacfdded63a791b3ce87bff30 Mon Sep 17 00:00:00 2001 From: Atadilo Date: Wed, 24 Jan 2018 20:32:25 +0100 Subject: [PATCH] Fix vSphere provider (#84) --- parser_test.go | 26 +++++++++++++++++++++++--- resource.go | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/parser_test.go b/parser_test.go index 0fa1045..001eaeb 100644 --- a/parser_test.go +++ b/parser_test.go @@ -283,6 +283,15 @@ const exampleStateFile = ` }, "deposed": [], "provider": "provider.scaleway" + }, + "vsphere_virtual_machine.twelve": { + "type": "vsphere_virtual_machine", + "primary": { + "id": "422cfa4a-c6bb-3405-0335-2d9b2034405f", + "attributes": { + "default_ip_address": "10.20.30.50" + } + } } } } @@ -303,9 +312,10 @@ const expectedListOutput = ` "10.0.1.1", "10.120.0.226", "10.2.1.5", + "10.20.30.40", "192.168.0.3", "50.0.0.1", - "10.20.30.40" + "10.20.30.50" ], "vars": { "datacenter": "mydc", @@ -326,6 +336,7 @@ const expectedListOutput = ` "nine": ["10.0.0.9"], "ten": ["10.0.0.10"], "eleven": ["10.0.0.11"], + "twelve": ["10.20.30.50"], "one.0": ["10.0.0.1"], "dup.0": ["10.0.0.1"], @@ -340,11 +351,12 @@ const expectedListOutput = ` "nine.0": ["10.0.0.9"], "ten.0": ["10.0.0.10"], "eleven.0": ["10.0.0.11"], + "twelve.0": ["10.20.30.50"], "type_aws_instance": ["10.0.0.1", "10.0.1.1", "50.0.0.1"], "type_digitalocean_droplet": ["192.168.0.3"], "type_cloudstack_instance": ["10.2.1.5"], - "type_vsphere_virtual_machine": ["10.20.30.40"], + "type_vsphere_virtual_machine": ["10.20.30.40", "10.20.30.50"], "type_openstack_compute_instance_v2": ["10.120.0.226"], "type_softlayer_virtual_guest": ["10.0.0.7"], "type_exoscale_compute": ["10.0.0.9"], @@ -373,9 +385,10 @@ const expectedInventoryOutput = `[all] 10.0.1.1 10.120.0.226 10.2.1.5 +10.20.30.40 192.168.0.3 50.0.0.1 -10.20.30.40 +10.20.30.50 [all:vars] datacenter="mydc" @@ -474,6 +487,12 @@ olddatacenter="\u003c0.7_format" [three.0] 192.168.0.3 +[twelve] +10.20.30.50 + +[twelve.0] +10.20.30.50 + [two] 50.0.0.1 @@ -511,6 +530,7 @@ olddatacenter="\u003c0.7_format" [type_vsphere_virtual_machine] 10.20.30.40 +10.20.30.50 [webserver] 192.168.0.3 diff --git a/resource.go b/resource.go index 5c6e36f..694cb2e 100644 --- a/resource.go +++ b/resource.go @@ -23,6 +23,7 @@ func init() { "ipaddress", // CS "ip_address", // VMware "network_interface.0.ipv4_address", // VMware + "default_ip_address", // provider.vsphere v1.1.1 "access_ip_v4", // OpenStack "floating_ip", // OpenStack "network_interface.0.access_config.0.nat_ip", // GCE