F5Networks / terraform-provider-bigip

Terraform resources that can configure F5 BIG-IP products
https://registry.terraform.io/providers/F5Networks/bigip/latest/docs
Mozilla Public License 2.0
105 stars 119 forks source link

BigIP provider crash when virtual server configured to use a port list. #571

Open ajchiarello opened 3 years ago

ajchiarello commented 3 years ago

Environment

Summary

I've created a virtual_server using the bigip terraform provider. I needed it to use a port list rather than a single port, so I made that change in the GUI, and then ran a terraform plan to see what it would try to change (so I could tell terraform to ignore that change). Instead, the provider crashed when it attempted to refresh the virtual server resource.

Steps To Reproduce

Create a bigip_ltm_virtual_server resource. Go to the web interface and configure the virtual server to use a port list. Run a terraform refresh, plan, or apply.

Output:

╷
│ Error: Request cancelled
│
│   with bigip_ltm_virtual_server.consul,
│   on install-consul.tf line 55, in resource "bigip_ltm_virtual_server" "consul":
│   55: resource "bigip_ltm_virtual_server" "consul" {
│
│ The plugin.(*GRPCProvider).ReadResource request was cancelled.
╵

Stack trace from the terraform-provider-bigip_v1.12.0 plugin:

panic: runtime error: index out of range [2] with length 0

goroutine 42 [running]:
github.com/F5Networks/terraform-provider-bigip/bigip.resourceBigipLtmVirtualServerRead(0xc0003fa070, 0x1020c00, 0xc0002820e0, 0xc0003fa070, 0x0)
        github.com/F5Networks/terraform-provider-bigip/bigip/resource_bigip_ltm_virtual_server.go:372 +0x2c0f
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000452780, 0xc000576ff0, 0x1020c00, 0xc0002820e0, 0xc00000f348, 0x0, 0x0)
        github.com/hashicorp/terraform-plugin-sdk@v1.1.0/helper/schema/resource.go:455 +0x12e
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadResource(0xc00000ebb0, 0x11b3610, 0xc0001f3830, 0xc000576f00, 0xc00000ebb0, 0xc0001f3830, 0xc000692a50)
        github.com/hashicorp/terraform-plugin-sdk@v1.1.0/internal/helper/plugin/grpc_provider.go:525 +0x3dd
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadResource_Handler(0xfdfce0, 0xc00000ebb0, 0x11b3610, 0xc0001f3830, 0xc0002c30e0, 0x0, 0x11b3610, 0xc0001f3830, 0xc00037cfc0, 0x222)
        github.com/hashicorp/terraform-plugin-sdk@v1.1.0/internal/tfplugin5/tfplugin5.pb.go:3153 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000c6000, 0x11bbf78, 0xc0002e2c00, 0xc000544500, 0xc0005805d0, 0x1717c70, 0x0, 0x0, 0x0)
        google.golang.org/grpc@v1.23.0/server.go:995 +0x482
google.golang.org/grpc.(*Server).handleStream(0xc0000c6000, 0x11bbf78, 0xc0002e2c00, 0xc000544500, 0x0)
        google.golang.org/grpc@v1.23.0/server.go:1275 +0xd2c
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00049a1b0, 0xc0000c6000, 0x11bbf78, 0xc0002e2c00, 0xc000544500)
        google.golang.org/grpc@v1.23.0/server.go:710 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.23.0/server.go:708 +0xa5

Error: The terraform-provider-bigip_v1.12.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

ERRO[0009] 1 error occurred:
        * exit status 1

Expected Behavior

Ideally, that the terraform provider supported port lists for virtual servers. Minimally, that I can add one in the gui and tell terraform to ignore_changes on it. Minimally, that it doesn't crash the provider completely.

trinaths commented 3 years ago

@ajchiarello - Please provide TF manifest to verify this issue at our end.

ajchiarello commented 3 years ago

Here's the BIG-IP resources. In this, I do have a port defined under the virtual_server, because one is required to create the resource; as I said in the original post, changing it to a port list in the F5 and then running anything that triggers a terraform refresh will crash the provider.

resource "bigip_ltm_pool" "consul" {
  name     = "/K8S/${var.project_name}-pool"
  monitors = ["/K8S/https_8501"]
}

resource "bigip_ltm_pool_attachment" "consul_web" {
  for_each = local.consul_name_ip_map
  pool     = bigip_ltm_pool.consul.name
  node     = "${bigip_ltm_node.consul[each.key].name}:8501"
}

resource "bigip_ltm_node" "consul" {
  for_each = local.consul_name_ip_map
  name     = "/K8S/${each.key}"
  address  = each.value
}

resource "bigip_ltm_virtual_server" "consul" {
  name                       = "/K8S/${var.project_name}"
  destination                = var.consul_f5_ip
  ip_protocol                = "tcp"
  port                       = "8501"
  pool                       = bigip_ltm_pool.consul.name
  profiles                   = ["/Common/tcp"]
  source_address_translation = "automap"
}
trinaths commented 3 years ago

Created INFRAANO-599 for internal tracking.

urohit011 commented 2 years ago

I have raised BUG - 1068173, for this issue.

ajchiarello commented 2 years ago

Is there any timeline for resolving this bug?

trinaths commented 2 years ago

@ajchiarello - This issue is with another team. We raised this issue BUG - 1068173.

gmouratidis commented 2 years ago

Greetings, is there any updates on this topic or an ETA for a release covering this? We also have some usecases where portlist setup on VS via the TF provider would be required.

trinaths commented 2 years ago

@gmouratidis this issue must be resolved in BIGIP to be resolved from ansible. Please followup with BID 1068173

ajchiarello commented 2 years ago

@trinaths How would one go about following up on the bug ID?

malacration commented 1 year ago

I have the same need for port list configuration

pgouband commented 1 year ago

Hi @gmouratidis, @ajchiarello and @malacration,

Bug ID 1068173 needs to be fixed first on TMOS. To get an update about this bug ID, you need to open a ticket via https://my.f5.com