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

Resource and data source vcd_edgegateway add network support for multiple subnets, sub-allocated pools and rate limits #401

Merged
merged 32 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9295238
WIP
Didainius Nov 13, 2019
96af345
WIP
Didainius Nov 14, 2019
0e8fe0d
Tests getting close
Didainius Nov 14, 2019
0c4c32d
All tests pass
Didainius Nov 14, 2019
e59e656
empty tests pass
Didainius Nov 14, 2019
4419cee
merge master
Didainius Nov 15, 2019
3b801ab
fix govcd bump
Didainius Nov 15, 2019
9d364a0
rename function
Didainius Nov 15, 2019
fa09729
IP_ADDRES does not work
Didainius Nov 15, 2019
e0f0cc1
Export all IPs in computed 'external_network_ips' field
Didainius Nov 18, 2019
9214164
docs and tests
Didainius Nov 18, 2019
0fd8f72
Merge master
Didainius Nov 18, 2019
0303937
Tests pass, github issue marked
Didainius Nov 18, 2019
29b7aa8
include govcd pr
Didainius Nov 19, 2019
f356ad8
Added changelog notes, parallel test to catch failures
Didainius Nov 19, 2019
dc58e9e
Upgrade SDK to 1.3.0, pull in later govcd, add more tests
Didainius Nov 19, 2019
2a8ee46
Remove legacy syntax checks
Didainius Nov 19, 2019
30ad647
cleanup tests and comments
Didainius Nov 19, 2019
861469b
go mod vendor && tidy
Didainius Nov 19, 2019
31716df
Add correct github issue to changelog
Didainius Nov 19, 2019
d96f123
Remove old syntax fox tf configs
Didainius Nov 20, 2019
45c8a33
Add deprecation info to fields in data source
Didainius Nov 20, 2019
dc2b6e2
Do not enable distributed routing during tests
Didainius Nov 20, 2019
9b46264
Merge master
Didainius Nov 21, 2019
baaba7f
go mod tidy
Didainius Nov 21, 2019
271bc3f
Address changelog notes
Didainius Nov 27, 2019
6ffac7a
merge master
Didainius Nov 29, 2019
4ade9d5
bump govcd
Didainius Nov 29, 2019
dced79d
Address documentation review
Didainius Nov 29, 2019
cee3fd8
Split functions
Didainius Nov 29, 2019
8819b76
Merge master
Didainius Dec 4, 2019
e64db20
Address comment in docs
Didainius Dec 4, 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
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ IMPROVEMENTS:
passthrough - [GH-384]
* Fix code warnings from `staticcheck` and add command `make static` to Travis tests
* `resource/vcd_edge_gateway` and `datasource/vcd_edge_gateway` add `default_external_network_ip`
field to export default edge gateway IP address - [GH-389]
and `external_network_ips` fields to export default edge gateway IP address and other external
network IPs used on gateway interfaces - [GH-389, GH-401]
* Add `token` to the `vcd` provider for the ability of connecting with an authorization token - [GH-280]
* Add command `make token` to create an authorization token from testing credentials
* Clean up interpolation-only expressions from tests (as allowed in terraform v0.12.11+)
Expand All @@ -38,6 +39,12 @@ IMPROVEMENTS:
* `resource/vcd_network_direct` Add property `description`
* `resource/vcd_network_routed` Add check for valid IPs [GH-374]
* `resource/vcd_network_isolated` Add check for valid IPs [GH-373]
* `resource/vcd_edgegateway` new fields `fips_mode_enabled`, `use_default_route_for_dns_relay`
- [GH-401]
* `resource/vcd_edgegateway` new `external_network` block for advanced configurations of external
networks including multiple subnets, IP pool sub-allocation and rate limits - [GH-401]
* `resource/vcd_edgegateway` enables read support for field `distributed_routing` after switch to
vCD API v29.0 - [GH-401]

BUG FIXES:

Expand All @@ -52,6 +59,8 @@ BUG FIXES:
DEPRECATIONS:

* Deprecated property `storage_profile` in resource `vcd_vapp`, as the corresponding field is now enabled in `vcd_vapp_vm`
* `resource/vcd_edgegateway` deprecates fields `external_networks` and `default_gateway_network` in
favor of new `external_network` block(s) - [GH-401]

## 2.5.0 (October 28, 2019)

Expand Down Expand Up @@ -115,6 +124,7 @@ IMPROVEMENTS:
* Import functions can now use custom separators instead of "." ([#343](https://github.com/terraform-providers/terraform-provider-vcd/issues/343))
* `resource/vcd_vapp_vm` has new field `computer_name` ([#334](https://github.com/terraform-providers/terraform-provider-vcd/issues/334), [#347](https://github.com/terraform-providers/terraform-provider-vcd/issues/347))


BUG FIXES:

* Change default value for `vcd_org.deployed_vm_quota` and `vcd_org.stored_vm_quota`. It was incorrectly set at `-1` instead of `0`.
Expand Down
94 changes: 94 additions & 0 deletions vcd/datasource_vcd_edgegateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,30 @@ func datasourceVcdEdgeGateway() *schema.Resource {
Type: schema.TypeList,
Computed: true,
Description: "A list of external networks to be used by the edge gateway",
Deprecated: "Please use the more advanced 'external_network' block(s)",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"default_gateway_network": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Deprecated: "Please use 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{
Type: schema.TypeString,
Computed: true,
Description: "IP address of edge gateway interface which is used as default.",
},
"external_network_ips": {
Computed: true,
Type: schema.TypeList,
Description: "List of IP addresses set on edge gateway external network interfaces",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"distributed_routing": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -97,6 +107,90 @@ func datasourceVcdEdgeGateway() *schema.Resource {
Computed: true,
Description: "'accept' or 'deny'. Default 'deny'",
},
"fips_mode_enabled": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "Enable FIPS mode. FIPS mode turns on the cipher suites that comply with FIPS. (False by default)",
},
"use_default_route_for_dns_relay": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
lvirbalas marked this conversation as resolved.
Show resolved Hide resolved
Description: "If true, default gateway will be used for the edge gateways' default routing and DNS forwarding.(False by default)",
},
"external_network": {
Type: schema.TypeSet,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please confirm whether using TypeSet leads to the issue where changing (updating) value of any field in HCL shows the whole external_network block as being deleted and re-created during a terraform plan.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will show it. Something like that:

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A remotely related issue at HashiCorp for reference:
hashicorp/terraform#21901

Description: "One or more blocks with external network information to be attached to this gateway's interface",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Computed: true,
Type: schema.TypeString,
Description: "External network name",
},
"enable_rate_limit": {
Computed: true,
Type: schema.TypeBool,
Description: "Enable rate limitting",
},
"incoming_rate_limit": {
Computed: true,
Type: schema.TypeFloat,
Description: "Incoming rate limit (Mbps)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please confirm that Mbps is what API is using (just want to make sure we avoid nasty conversion issues).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. And funny enough it works properly with float values (included in tests as well):
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have case where API and UI don't match Types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, but these numbers in screenshot were created using provider, not entered manually.

},
"outgoing_rate_limit": {
Computed: true,
Type: schema.TypeFloat,
Description: "Outgoing rate limit (Mbps)",
},
"subnet": {
Computed: true,
Type: schema.TypeSet,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"gateway": {
Computed: true,
Description: "Gateway address for a subnet",
Type: schema.TypeString,
},
"netmask": {
Computed: true,
Description: "Netmask address for a subnet",
Type: schema.TypeString,
},
"ip_address": {
Computed: true,
Type: schema.TypeString,
Description: "IP address on the edge gateway - will be auto-assigned if not defined",
},
"use_for_default_route": {
Computed: true,
Type: schema.TypeBool,
Description: "Defines if this subnet should be used as default gateway for edge",
},
"suballocate_pool": {
Type: schema.TypeSet,
Computed: true,
Description: "Define zero or more blocks to sub-allocate pools on the edge gateway",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"start_address": {
Computed: true,
Type: schema.TypeString,
},
"end_address": {
Computed: true,
Type: schema.TypeString,
},
},
},
},
},
},
},
},
},
},
},
}
}
Expand Down
Loading