Merge branch 'master' of github.com:hashicorp/terraform

* 'master' of github.com:hashicorp/terraform:
  Update CHANGELOG.md
  provider/vsphere: read gateway and ipv6_gateway
  provider/aws: Fix cloudtrail_tags config formatting in test (#6615)
  build: "make fmt" to ignore vendor packages
This commit is contained in:
clint shryock 2016-05-11 10:39:21 -05:00
commit e33847c8a8
5 changed files with 51 additions and 8 deletions

View File

@ -18,6 +18,7 @@ IMPROVEMENTS:
BUG FIXES: BUG FIXES:
* core: Correct the previous fix for a bug causing "attribute not found" messages during destroy, as it was insufficient [GH-6599] * core: Correct the previous fix for a bug causing "attribute not found" messages during destroy, as it was insufficient [GH-6599]
* provider/vsphere: `gateway` and `ipv6_gateway` are now read from `vsphere_virtual_machine` resources [GH-6522]
## 0.6.16 (May 9, 2016) ## 0.6.16 (May 9, 2016)

View File

@ -1,5 +1,6 @@
TEST?=$$(go list ./... | grep -v /vendor/) TEST?=$$(go list ./... | grep -v /vendor/)
VETARGS?=-all VETARGS?=-all
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
default: test vet default: test vet
@ -80,7 +81,7 @@ generate:
@go fmt command/internal_plugin_list.go > /dev/null @go fmt command/internal_plugin_list.go > /dev/null
fmt: fmt:
gofmt -w . gofmt -w $(GOFMT_FILES)
fmtcheck: fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

View File

@ -617,23 +617,33 @@ POLICY
` `
func testAccAWSCloudTrailConfig_tags(cloudTrailRandInt int) string { func testAccAWSCloudTrailConfig_tags(cloudTrailRandInt int) string {
return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, tagsString := `tags {
`tags {
Foo = "moo" Foo = "moo"
Pooh = "hi" Pooh = "hi"
}`, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt) }`
return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl,
cloudTrailRandInt,
tagsString,
cloudTrailRandInt,
cloudTrailRandInt,
cloudTrailRandInt)
} }
func testAccAWSCloudTrailConfig_tagsModified(cloudTrailRandInt int) string { func testAccAWSCloudTrailConfig_tagsModified(cloudTrailRandInt int) string {
return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, tagsString := `tags {
`tags {
Foo = "moo" Foo = "moo"
Pooh = "hi" Pooh = "hi"
Moo = "boom" Moo = "boom"
}`, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt) }`
return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl,
cloudTrailRandInt,
tagsString,
cloudTrailRandInt,
cloudTrailRandInt,
cloudTrailRandInt)
} }
func testAccAWSCloudTrailConfig_tagsModifiedAgain(cloudTrailRandInt int) string { func testAccAWSCloudTrailConfig_tagsModifiedAgain(cloudTrailRandInt int) string {
return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl,
"", cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt) cloudTrailRandInt, "", cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt)
} }

View File

@ -795,6 +795,31 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
networkInterfaces = append(networkInterfaces, networkInterface) networkInterfaces = append(networkInterfaces, networkInterface)
} }
} }
if mvm.Guest.IpStack != nil {
for _, v := range mvm.Guest.IpStack {
if v.IpRouteConfig != nil && v.IpRouteConfig.IpRoute != nil {
for _, route := range v.IpRouteConfig.IpRoute {
if route.Gateway.Device != "" {
gatewaySetting := ""
if route.Network == "::" {
gatewaySetting = "ipv6_gateway"
} else if route.Network == "0.0.0.0" {
gatewaySetting = "ipv4_gateway"
}
if gatewaySetting != "" {
deviceID, err := strconv.Atoi(route.Gateway.Device)
if err != nil {
log.Printf("[WARN] error at processing %s of device id %#v: %#v", gatewaySetting, route.Gateway.Device, err)
} else {
log.Printf("[DEBUG] %s of device id %d: %s", gatewaySetting, deviceID, route.Gateway.IpAddress)
networkInterfaces[deviceID][gatewaySetting] = route.Gateway.IpAddress
}
}
}
}
}
}
}
log.Printf("[DEBUG] networkInterfaces: %#v", networkInterfaces) log.Printf("[DEBUG] networkInterfaces: %#v", networkInterfaces)
err = d.Set("network_interface", networkInterfaces) err = d.Set("network_interface", networkInterfaces)
if err != nil { if err != nil {

View File

@ -50,6 +50,7 @@ func TestAccVSphereVirtualMachine_basic(t *testing.T) {
gateway, gateway,
label, label,
ip_address, ip_address,
gateway,
datastoreOpt, datastoreOpt,
template, template,
), ),
@ -111,6 +112,7 @@ func TestAccVSphereVirtualMachine_diskInitType(t *testing.T) {
gateway, gateway,
label, label,
ip_address, ip_address,
gateway,
datastoreOpt, datastoreOpt,
template, template,
), ),
@ -490,6 +492,7 @@ func TestAccVSphereVirtualMachine_createWithExistingVmdk(t *testing.T) {
gateway, gateway,
label, label,
ip_address, ip_address,
gateway,
datastoreOpt, datastoreOpt,
vmdk_path, vmdk_path,
), ),
@ -935,6 +938,7 @@ resource "vsphere_virtual_machine" "foo" {
label = "%s" label = "%s"
ipv4_address = "%s" ipv4_address = "%s"
ipv4_prefix_length = 24 ipv4_prefix_length = 24
ipv4_gateway = "%s"
} }
disk { disk {
%s %s
@ -958,6 +962,7 @@ resource "vsphere_virtual_machine" "thin" {
label = "%s" label = "%s"
ipv4_address = "%s" ipv4_address = "%s"
ipv4_prefix_length = 24 ipv4_prefix_length = 24
ipv4_gateway = "%s"
} }
disk { disk {
%s %s
@ -1078,6 +1083,7 @@ resource "vsphere_virtual_machine" "with_existing_vmdk" {
label = "%s" label = "%s"
ipv4_address = "%s" ipv4_address = "%s"
ipv4_prefix_length = 24 ipv4_prefix_length = 24
ipv4_gateway = "%s"
} }
disk { disk {
%s %s