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 load balancer server pool resource and datasource #268

Merged
merged 62 commits into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1b89ecb
Add load balancer service monitor resource and datasource
Didainius May 17, 2019
14cfc76
Add misc test, more adjustments
Didainius Jun 7, 2019
cff09d4
rebase ant start using real locks
Didainius Jun 7, 2019
6e81383
Bump govcd dependency
Didainius Jun 7, 2019
5ba7ec4
Adjust validations and tests
Didainius Jun 7, 2019
1efd324
Update gitignore to ommit .vscode
Didainius Jun 7, 2019
5bec871
Cleanup old comments
Didainius Jun 7, 2019
7b43f23
Add sample for expandLBMonitor
Didainius Jun 11, 2019
562ff84
call flattenLBMonitor on update return
Didainius Jun 11, 2019
a1f12fa
Improve names, fmt sample snippet
Didainius Jun 11, 2019
7ca3aad
Lowercase function name
Didainius Jun 11, 2019
bc9c783
Add options list for method
Didainius Jun 11, 2019
4e988ac
Add url parameter to test and examples
Didainius Jun 11, 2019
b982cc0
Add names to description, unify case checking function
Didainius Jun 11, 2019
c947c70
change import name in examples
Didainius Jun 12, 2019
385ffec
health -> /health
Didainius Jun 12, 2019
9b44d3a
bump govcd dependency
Didainius Jun 12, 2019
a3b842f
bump govcd dependency
Didainius Jun 12, 2019
eedeb83
bump dependency after govcd rebase
Didainius Jun 13, 2019
1335d75
Rename flatten/expand functions
Didainius Jun 13, 2019
446b02a
bump govcd, add note for requirement of advanced edge gw
Didainius Jun 13, 2019
6270aa7
Bump dependency to master branch
Didainius Jun 13, 2019
ea070cb
Add website import note, show units for interval
Didainius Jun 14, 2019
0ee1c4e
Address comments
Didainius Jun 14, 2019
179179b
Add descriptions for non-computed fields in datasource
Didainius Jun 14, 2019
153274e
Add load balancer service monitor resource and datasource
Didainius May 17, 2019
4c7700c
WIP
Didainius Jun 3, 2019
5ae1dc9
works with TypeSet
Didainius Jun 5, 2019
9b59156
Add test
Didainius Jun 5, 2019
3bd1ea9
Add import test
Didainius Jun 6, 2019
fa8894d
Add website documentation
Didainius Jun 6, 2019
b8a50bd
Remove duplicates after rebase
Didainius Jun 14, 2019
e64c22a
tests semi-pass
Didainius Jun 14, 2019
bc8028f
Adjust as per first PR reviews
Didainius Jun 18, 2019
b0abaac
Update test template
Didainius Jun 18, 2019
9ca3c02
Further updates
Didainius Jun 18, 2019
e7d495f
Fix tests
Didainius Jun 19, 2019
09c7f9c
Fix algorithm_parameters
Didainius Jun 19, 2019
87e35ca
Use current service monitor
Didainius Jun 19, 2019
8b98a03
Add load balancer server pool CRUD
Didainius Jun 19, 2019
5d09103
Change casing in documentation
Didainius Jun 19, 2019
0e680eb
Fix unfixed merge
Didainius Jun 19, 2019
c6795cb
Fix imports
Didainius Jun 19, 2019
8ed00b4
Adjust changelog with proper pull request number
Didainius Jun 19, 2019
7120803
Merge latest master, adjust CHANGELOG
Didainius Jun 26, 2019
772e30a
Pull in latest govcd
Didainius Jun 26, 2019
51a1a84
refactor from master
Didainius Jun 26, 2019
4800654
Remove hardcoded value
Didainius Jun 26, 2019
ba03ea9
Bump govcd dependency
Didainius Jun 26, 2019
2a77cae
bump govcd, address feedback
Didainius Jun 26, 2019
3c7246d
Add missing build tags
Didainius Jun 26, 2019
06bad1e
Add missing build tags
Didainius Jun 26, 2019
8dc86c7
Fix data source naming
Didainius Jun 27, 2019
35ccbd1
Merge branch 'lb222' of github.com:Didainius/terraform-provider-vcd i…
Didainius Jun 27, 2019
290a07f
Add descriptions to data sources
Didainius Jun 27, 2019
7a64aef
bump govcd dependency
Didainius Jun 28, 2019
9c4a4bd
ip address is mandatory
Didainius Jun 28, 2019
100b4e2
Use empty description in one test step
Didainius Jul 1, 2019
df5f27e
Skip enable_transparency in teststep0
Didainius Jul 1, 2019
7c53be6
Merge master
Didainius Jul 1, 2019
7af9972
Bump govcd
Didainius Jul 1, 2019
0a1c7e9
Bump govcd tag
Didainius Jul 1, 2019
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
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
## 2.4.0 (Unreleased)
IMPROVEMENTS:

* Change resource handling to use locking mechanism when resource parallel handling is not supported by vCD. [GH-#255]
* Change resource handling to use locking mechanism when resource parallel handling is not supported by vCD. [GH-255]
* Fix issue when vApp is power cycled during member VM deletion. [GH-261]

FEATURES:

* **New Resource:** Load Balancer Service Monitor `vcd_lb_service_monitor` - [GH-256]
* **New Data Source:** Load Balancer Service Monitor `vcd_lb_service_monitor` - [GH-256]
* **New Resource:** edge gateway `vcd_edgegateway` creates and deletes edge gateways - [GH-262](https://github.com/terraform-providers/terraform-provider-vcd/issues/262)
* **New Resource:** edge gateway `vcd_edgegateway` creates and deletes edge gateways - [GH-262]
* **New build command** `make test-env-build` can configure an empty vCD to run the test suite. See `TESTING.md` for details.
* **New Resource:** Load Balancer Server Pool `vcd_lb_server_pool` - [GH-268]
* **New Data Source:** Load Balancer Server Pool `vcd_lb_server_pool` - [GH-268]

## 2.3.0 (May 29, 2019)

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ require (
github.com/hashicorp/terraform v0.12.0
github.com/vmware/go-vcloud-director/v2 v2.3.0-alpha.3
)

replace github.com/vmware/go-vcloud-director/v2 => github.com/Didainius/go-vcloud-director/v2 v2.3.0-alpha.3.0.20190626104558-f11b3d12830a
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ github.com/Azure/go-autorest v10.15.4+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxS
github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4=
github.com/Didainius/go-vcloud-director/v2 v2.3.0-alpha.3.0.20190626104558-f11b3d12830a h1:4KrzZ1M30O1dktOnZyuCEFeLVAdbHKH8crZuuA1Y8C0=
github.com/Didainius/go-vcloud-director/v2 v2.3.0-alpha.3.0.20190626104558-f11b3d12830a/go.mod h1:HonlGxbjJ1NAibWh99eE4/S2l6ZOZ5KJzKK1rh2a9vc=
github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no=
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
Expand Down Expand Up @@ -301,8 +303,6 @@ github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4A
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.3.0-alpha.3 h1:cgQGF5SmFtHPbwUESzlKu6C8mXBoCei/Wqkji8aScBM=
github.com/vmware/go-vcloud-director/v2 v2.3.0-alpha.3/go.mod h1:+Hq7ryFfgZqsO6mXH29RQFnpIMSujCOMI57otHoXHhQ=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
Expand Down
120 changes: 120 additions & 0 deletions vcd/datasource_vcd_lb_server_pool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package vcd

import (
"fmt"

"github.com/hashicorp/terraform/helper/schema"
"github.com/vmware/go-vcloud-director/v2/types/v56"
)

func datasourceVcdLbServerPool() *schema.Resource {
return &schema.Resource{
Read: datasourceVcdLbServerPoolRead,
Schema: map[string]*schema.Schema{
"org": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "vCD organization in which the Service Monitor is located",
lvirbalas marked this conversation as resolved.
Show resolved Hide resolved
},
"vdc": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "vCD virtual datacenter in which the Service Monitor is located",
},
"edge_gateway": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Edge gateway name in which the Server Pool is located",
},
"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
Description: "Server Pool name for lookup",
},
"description": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"algorithm": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"algorithm_parameters": {
Type: schema.TypeString,
Computed: true,
},
"monitor_id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"enable_transparency": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
},
"member": {
Computed: true,
Type: schema.TypeList,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
},
"condition": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"name": {
Type: schema.TypeString,
Computed: true,
},
"ip_address": {
Type: schema.TypeString,
Computed: true,
},
"port": {
Type: schema.TypeInt,
Computed: true,
lvirbalas marked this conversation as resolved.
Show resolved Hide resolved
},
"monitor_port": {
Type: schema.TypeInt,
Computed: true,
},
"weight": {
Type: schema.TypeInt,
Computed: true,
},
"min_connections": {
Type: schema.TypeInt,
Computed: true,
},
"max_connections": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
},
}
}

func datasourceVcdLbServerPoolRead(d *schema.ResourceData, meta interface{}) error {
vcdClient := meta.(*VCDClient)
edgeGateway, err := vcdClient.GetEdgeGatewayFromResource(d, "edge_gateway")
if err != nil {
return fmt.Errorf(errorUnableToFindEdgeGateway, err)
}

readLBPool, err := edgeGateway.ReadLBServerPool(&types.LBPool{Name: d.Get("name").(string)})
if err != nil {
return fmt.Errorf("unable to find load balancer server pool with Name %s: %s",
d.Get("name").(string), err)
}

d.SetId(readLBPool.ID)
return setLBPoolData(d, readLBPool)
}
4 changes: 3 additions & 1 deletion vcd/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ func Provider() terraform.ResourceProvider {
"vcd_independent_disk": resourceVcdIndependentDisk(), // 2.1
"vcd_external_network": resourceVcdExternalNetwork(), // 2.2
"vcd_lb_service_monitor": resourceVcdLbServiceMonitor(), // 2.4
"vcd_lb_server_pool": resourceVcdLBServerPool(), // 2.4
},

DataSourcesMap: map[string]*schema.Resource{
"vcd_lb_service_monitor": datasourceVcdLbServiceMonitor(),
"vcd_lb_service_monitor": datasourceVcdLbServiceMonitor(), // 2.4
"vcd_lb_server_pool": datasourceVcdLbServerPool(), // 2.4
},

ConfigureFunc: providerConfigure,
Expand Down
Loading