-
Notifications
You must be signed in to change notification settings - Fork 112
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
Conversation
vcd_edgegateway
add network support for multiple subnets and sub-allocated poolsvcd_edgegateway
add network support for multiple subnets, sub-allocated pools and rate limits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First comments. This one is big ;)
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, |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
"incoming_rate_limit": { | ||
Computed: true, | ||
Type: schema.TypeFloat, | ||
Description: "Incoming rate limit (Mbps)", |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation requests.
* `configuration` - (Required) Configuration of the vShield edge VM for this gateway. One of: `compact`, `full` ("Large"), `x-large`, `full4` ("Quad Large"). | ||
* `default_gateway_network` - (Optional) Name of the external network to be used as default gateway. It must be included in the | ||
* `default_gateway_network` - (Deprecated, Optional) Name of the external network to be used as default gateway. It must be included in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which field replaces this deprecated one?
In general, it feels we should add a sentence to all deprecated fields saying "Please use ... instead" to avoid putting the user into detective clothes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added pointers - please check if it makes sense to have them at the end of description or I should move the new field descriptions to the front.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall complicated PR. Can't do good review do that code is complicated and have to know structures, changes, overall understand inside things. Also SDK upgrade should be as separate PR.
"incoming_rate_limit": { | ||
Computed: true, | ||
Type: schema.TypeFloat, | ||
Description: "Incoming rate limit (Mbps)", |
There was a problem hiding this comment.
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.
// <OutRateLimit>100</OutRateLimit> | ||
// <UseForDefaultRoute>true</UseForDefaultRoute> | ||
// </GatewayInterface> | ||
func getGatewayInterfacesType(vcdClient *VCDClient, externalInterfaceSet *schema.Set) ([]*types.GatewayInterface, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we divide this function with meaningful names to make self documented code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split it, but IMHO the names are already meaningful as they can be with this API structure for interfaces. To me now it is even harder to follow it, but you can check if it is more readable for fresh eyes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last doc polish in-line and LGTM. Thanks for a big addition!
default gateway. It must be included in the list of `external_networks`. Providing an empty string | ||
or omitting the argument will create the edge gateway without a default gateway. **Please use** | ||
the [external network](#external-network) block structure and `use_for_default_route` to specify | ||
a subnet should be used as default route. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a subnet should be used as default route. | |
a subnet which should be used as a default route. |
Don't forget to solve conflicts |
This PR closes #323, closes #397
This is a list of things it brings:
external_networks
list of networks in favor of newexternal_network
block which allows to specify one or more subnets inside the network and suballocate IPs from those ranges. Also deprecatesdefault_gateway_network
field. Note: as far as I tested allexternal_network
block features work with simple edge gateway as wellexternal_network_ips
computed field to get all IP addresses set on uplink gateway interfaces (in addition to default IP indefault_external_network_ip
field)TestAccVcdEdgeGatewayParallelCreation
which aims to catch a reported error when two edge gateways are being attached to the same external network at the same time (so far I did not reproduce the error)distributed_routing
was not read due to older API version not returning it.fips_mode_enabled
to enable FIPS mode (it must be enabled by vCD administrator in general settings to make it work, otherwise returns a human readable error). Note FIPS mode field is not being returned from API therefore it does not support readNote: It does not yet support update.
Important. There is one problem with data sources which should be solved by this PR hashicorp/terraform-plugin-sdk#197 but is not yet done. The problem is that when a
TypeSet
contains only computed variables and there are multiple blocks, only one is stored. This situation is documented and tested in existingTestAccVcdEdgeGatewayExternalNetworks
test