Closed owensk closed 7 years ago
Hey @owensk, can you point me to the place in the GCP documentation that says an empty forwarding rule should forward all ports (or where you expect it to say that it can't be empty)? I'll follow up internally on that. In the meantime, I'll make the error more clear in terraform.
I can't seem to find what I was looking at originally. I was able to find: https://www.terraform.io/docs/providers/google/r/compute_forwarding_rule.html which specifies https://www.terraform.io/docs/providers/google/r/compute_forwarding_rule.html
which doesn't work as documented.
It looks like this might be a documentation defect and could probably be fixed with a change there and some form of error in the plan stage.
Recently I have faced the same issue. I was trying to create forwarding rule with INTERNAL scheme, backend service and all ports to forward. I was expecting that omitting ports value will do the trick, but got the exception:
Error 400: Invalid value for field 'resource.ports[0]': ''. Forwarding rules with backend services must specify at least one port., invalid
@danawillow, please, check GCP documentation: https://cloud.google.com/load-balancing/docs/forwarding-rules
ports [Optional] A single port or single contiguous port range, ranging from low to high, for which this forwarding rule matches. Packets of the specified protocol sent to these ports will be forwarded to the appropriate target pool or target instance. If this field is left empty, then the forwarding matches traffic for all ports for the specified protocol.
Is there currently any way to create internal forwarding rule with all ports to forward using Terraform?
Hey @Integrity-178B, this is a pretty old issue. Could you file a new one in the Google provider repository instead? https://github.com/terraform-providers/terraform-provider-google. Thanks!
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.
Terraform Version
Terraform v0.9.3
Affected Resource(s)
Terraform Configuration Files
Debug Output
Plan output:
Apply Ouput:
Expected Behavior
Should create forwarding rule that forwards all ports to all instances in backend.
Actual Behavior
Doesn't create anything on
apply
.plan
doesn't fail because lacking a value in ports.Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform plan
to see changeterraform apply
to attempt changeImportant Factoids
ports
is listed as optional. Appears to be "exclusive or" with port_range and success there depends on whetherload_balancing_scheme
isINTERNAL
orEXTERNAL
.