-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
vcd_dnat missing separate original and translated port in vCloud Director provider #12384
Comments
Upstream govcloudair issue: vmware-archive/govcloudair#37 |
Hi @pasikarkkainen as per my comment on vmware-archive/govcloudair#37 I would try to maintain backwards compatibility in the govcloudair library by renaming the current function to a new AddNATPortMapping() function and adding your enhancements, with a new wrapper AddNATMapping() function just passing through the old format parameters. Then you can update terraform to use the new AddNATPortMapping() function. Again, to maintain backwards compatibility, my suggested approach would be to leave the existing port attribute in the vcd_dnat resource but making it optional / mutually exclusive with 2 new internal_port and external_port attributes. The documentation could then show that these two options are equivalent, and in time depricate the original port attribute:
|
Makes sense. I'm hoping to get to this next week. Thanks! |
@robcoward : It seems govcloudair library NATPortMapping PR has been merged to UKCloud fork of govcloudair. For the terraform vcd_provider parts.. should I send a PR against upstream terraform, or the UKCloud fork? What's your preference? Thanks! |
Hi @pasikarkkainen, my colleague @tlawrence beat me to hitting the merge button. Please submit any PR for the vcd_provider to the upstream hashicorp/terraform repo. |
Hi, Could someone help me to understand? The issue need to be fixed in govcloud, but how and when is that pulled into terraform. Can one track that? Does each terraform release automatically pull in the latest govcloud? |
HI @Boran, I suggest you have a read of the documentation, specifically https://github.com/hashicorp/terraform/#dependencies - it tells you all you need.
|
Hey @Boran . Yes, there is now support for separate original_port and translated_port in the UKCloud fork of govcloud library, but the Terraform parts to use that new feature haven't been done yet. I've been busy with other stuff. I expect to get the Terraform parts done some day in the future.. Are you interested in contributing/helping? |
Thanks @robcoward. Update: So my understand is that I develop as follows.. Moved work to a PR, if either of you would like to give me dev tips, that probably a better place to do it than here. |
So, PR ready, feedback appreciated. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Currently Terraform vCloud Director provider allows defining dnat rule like this:
resource "vcd_dnat" "web" {
edge_gateway = "Edge Gateway Name"
external_ip = "78.101.10.20"
port = 80
internal_ip = "10.10.0.5"
}
The obvious problem here is that we only have one definition of "port", and thus the "original port" and "translated port" end up being the same value. This isn't optimal.
Quite often one needs to be able to create dnat rules like these:
external port 2001 --> internal IP1 port 22.
external port 2002 --> internal IP2 port 22.
external port 2003 --> internal IP3 port 22.
Currently it's not possible to define such dnat rules with vCloud Director provider in terraform.
This limitation seems to come from the underlying vcd go library used: vmware-govcd edgegateway.go func AddNATMapping(nattype, externalIP, internalIP, port string) :
so "port" is used for both OriginalPort and TranslatedPort.. that needs to be fixed / improved first in the govcd library, and then in terraform vcd provider.
The text was updated successfully, but these errors were encountered: