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

Add support for network_dhcp_wait_seconds invcd_vapp_vm #436

Merged
merged 38 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6aff31f
Make deprecation message more precise
Didainius Jan 15, 2020
e28b8aa
Fix incorrect statement
Didainius Jan 15, 2020
1c223fa
WIP
Didainius Jan 15, 2020
917013f
Remove unneeded quotes
Didainius Jan 16, 2020
f63442f
Add extra logging
Didainius Jan 16, 2020
ce7af70
Improve tests
Didainius Jan 16, 2020
b38a5af
WIP - move element
Didainius Jan 16, 2020
64a9dda
Add docs
Didainius Jan 17, 2020
4889794
changelog, VM must be powered on
Didainius Jan 17, 2020
9d36d96
go mod vendor
Didainius Jan 17, 2020
6f31a7f
Cleanup test
Didainius Jan 17, 2020
b3cdfa0
Fix datasource
Didainius Jan 17, 2020
4bac834
Remove extraneus INFO message to user
Didainius Jan 17, 2020
2b2807b
Fix logging
Didainius Jan 18, 2020
55161fd
bump govcd
Didainius Jan 19, 2020
82d4aa4
Bump govcd
Didainius Jan 21, 2020
6cbe267
Fix typo in docs
Didainius Jan 21, 2020
a86b3f2
bump govcd
Didainius Jan 21, 2020
924f5b0
Merge master
Didainius Jan 22, 2020
fb837a5
Exit early during update when only dhcp timeout is changed
Didainius Jan 22, 2020
794bff4
Improve logging and move shared function to helpers.go
Didainius Jan 22, 2020
196fd47
Merge master
Didainius Feb 7, 2020
333699b
Pull in latest govcd
Didainius Feb 14, 2020
f6f504c
merge master
Didainius Feb 17, 2020
2d11f88
Fix website doc
Didainius Feb 17, 2020
51fd6e8
Fix double import
Didainius Feb 17, 2020
454edd1
Add missing field after merge
Didainius Feb 17, 2020
3e62b72
Rename global variable
Didainius Feb 17, 2020
8d8776c
Add sorting of NIC indexes to DHCP validation
Didainius Feb 17, 2020
db52bc1
All logs message should include 'DHCP IP Lookup' string
Didainius Feb 18, 2020
44c1840
Fix example reendering
Didainius Feb 18, 2020
6f3e73f
Add missing hcl highlight tag for independent_disk
Didainius Feb 18, 2020
6962421
Change dhcp_wait time in example
Didainius Feb 18, 2020
23ce70b
Change log formatting
Didainius Feb 18, 2020
d27537a
Adjust website comment
Didainius Feb 18, 2020
8d4f92b
Improve docs
Didainius Feb 18, 2020
13fb329
Fix typo
Didainius Feb 18, 2020
682f382
Bump govcd
Didainius Feb 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FEATURES:
* `vcd_vapp_vm` Internal disks in VM template allows to be edited by `override_template_disk` field
[GH-412]
* `vcd_org_vdc` can be created with Flex allocation in vCD 9.7 and later. Also two new fields added for Flex - `elasticity`, `include_vm_memory_overhead` [GH-443]
* `resource/vcd_vapp_vm` and `datasource/vcd_vapp_vm` get optional `network_dhcp_wait_seconds` field
to ensure `ip` is reported when `ip_allocation_mode=DHCP` is used [GH-436]

IMPROVEMENTS:

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ go 1.13
require (
github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/terraform-plugin-sdk v1.5.0
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.4
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.6
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvc
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU=
github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.4 h1:fFpq9kNMzehNWuh4Q4LPurqZdhxVkgszuA0qJ21csyk=
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.4/go.mod h1:XY9Fmqp1JeHIU2nP87NykB6unNCsY6qV4Zdu5JI4aZU=
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.6 h1:FixFeoQ0+q8sMVXVfEeVegoJPwcOiVOtEHV4UAjrpSM=
github.com/vmware/go-vcloud-director/v2 v2.6.0-alpha.6/go.mod h1:XY9Fmqp1JeHIU2nP87NykB6unNCsY6qV4Zdu5JI4aZU=
github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw=
github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
Expand Down
8 changes: 8 additions & 0 deletions vcd/datasource_vcd_vapp_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vcd

import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)

func datasourceVcdVAppVm() *schema.Resource {
Expand Down Expand Up @@ -71,6 +72,13 @@ func datasourceVcdVAppVm() *schema.Resource {
Computed: true,
Description: "Storage profile used with the VM",
},
"network_dhcp_wait_seconds": {
Optional: true,
Type: schema.TypeInt,
ValidateFunc: validation.IntAtLeast(0),
Description: "Optional number of seconds to try and wait for DHCP IP (valid for " +
"'network' block only)",
},
"network": {
Computed: true,
Type: schema.TypeList,
Expand Down
24 changes: 24 additions & 0 deletions vcd/helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package vcd

import (
"log"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

// onlyHasChange is a schema helper which accepts Terraform schema definition and checks if field
// with `fieldName` is the only one which has change (using d.HasChange)
func onlyHasChange(fieldName string, schema map[string]*schema.Schema, d *schema.ResourceData) bool {
log.Printf("[DEBUG] [VM update] checking if only field '%s' has change during update", fieldName)
for schemaFieldName := range schema {
// Skip checking defined field
if schemaFieldName == fieldName {
continue
}
if d.HasChange(schemaFieldName) {
log.Printf("[DEBUG] [VM update] field '%s' has change", schemaFieldName)
return false
}
}
return true
}
2 changes: 1 addition & 1 deletion vcd/resource_vcd_edgegateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func resourceVcdEdgeGateway() *schema.Resource {
Optional: true,
Computed: true,
ForceNew: true,
Deprecated: "Please use the more advanced 'external_network' block(s)",
Deprecated: "Please use 'use_for_default_route' flag in the more advanced 'external_network' block(s)",
Description: "External network to be used as default gateway. Its name must be included in 'external_networks'. An empty value will skip the default gateway",
},
"default_external_network_ip": &schema.Schema{
Expand Down
Loading