terraform-provider-bigip icon indicating copy to clipboard operation
terraform-provider-bigip copied to clipboard

Requesting the ability to use a port list in terraform for f5networks/bigip provider

Open WyrickC opened this issue 1 year ago • 3 comments

Hi,

I'm requesting the ability to use a port list in terraform so I can specify a range of ports for my virtual server to listen on. This can be done in the F5 UI but not terraform according to the documentation

Ideally, I would like to be able to do something like this:

resource "bigip_ltm_virtual_server" "VS_EXAMPLE" { pool = "/Common/POOL_EXAMPLE" name = "/Common/VS_EXAMPLE" description = "" destination = "10.0.0.0" translate_port = "enabled" ip_protocol = "any" port = [514, 12201, 12204, 12205] }

Any suggestions or workarounds in the meantime?

WyrickC avatar Feb 15 '24 14:02 WyrickC

Hi @WyrickC,

Have you tried using AS3?

pgouband avatar Feb 15 '24 14:02 pgouband

I have not. Can that be used to JSON port lists for a VS, or even the whole VS config? And were there any plans to add the port list option to terraform in the future? Thanks for the reply

WyrickC avatar Feb 15 '24 16:02 WyrickC

Hi @WyrickC,

Here an example of AS with port list: https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/latest/declarations/non-http-services.html#creating-port-and-address-lists-for-a-service

Another way of doing the configuration is using traffic matching criteria:

resource "bigip_command" "create-portlist" {
  commands = ["create net port-list /Common/portlist ports add { 80 } ports add { 443 }"]
}
resource "bigip_command" "create_trafficmatchingcriteria" {
  commands = ["create ltm traffic-matching-criteria /Common/test-traffic-matching destination-address-inline 10.0.0.1 destination-port-list /Common/portlist "]
}
resource "bigip_ltm_virtual_server" "VS_EXAMPLE" {
	pool = "/Common/POOL_EXAMPLE"
	name = "/Common/VS_EXAMPLE"
	description = ""
	translate_port = "enabled"
	ip_protocol = "any"
	trafficmatching_criteria = "/Common/test-traffic-matching"
}

pgouband avatar Feb 16 '24 10:02 pgouband