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
102 stars 117 forks source link

Terraform F5 Provider Crashes during Apply #964

Open JPatC opened 2 months ago

JPatC commented 2 months ago

Environment

Summary

We're using DO and AS3 to configure our F5 Big IPs through terraform (LTM, APM, ASM) and recently without any code changes the terraform provider started to crash.

Steps To Reproduce

Steps to reproduce the behavior:

When we run our code we get this error: Terraform v1.4.4 on linux_amd64 Initializing plugins and modules... bigip_as3.securitySettings: Creating... module.f5_02_partition2.bigip_ltm_policy.traffic_policies: Modifying... [id=/test/ece] module.f5_01_partition2.bigip_ltm_policy.traffic_policies: Modifying... [id=/test/ece] module.f5_01_partition2.bigip_ltm_policy.traffic_policies: Modifications complete after 1s [id=/test/ece] module.f5_02_partition2.bigip_ltm_policy.traffic_policies: Modifications complete after 1s [id=/test/ece] ╷ │ Warning: Version constraints inside provider configuration blocks are deprecated │ │ on main.tf line 13, in provider "aws": │ 13: version = "5.31.0" │ │ Terraform 0.13 and earlier allowed provider version constraints inside the │ provider configuration block, but that is now deprecated and will be │ removed in a future version of Terraform. To silence this warning, move the │ provider version constraint into the required_providers block. ╵ ╷ │ Error: Plugin did not respond │ │ with bigip_as3.securitySettings, │ on security.tf line 160, in resource "bigip_as3" "securitySettings": │ 160: resource "bigip_as3" "securitySettings"{ │ │ The plugin encountered an error, and failed to respond to the │ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may │ contain more details. ╵

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

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x73fb3e]

goroutine 26 [running]: github.com/f5devcentral/go-bigip.(BigIP).APICall(0x0, 0xc0005d5288, 0x0, 0x0, 0x0, 0x0, 0x0) github.com/f5devcentral/go-bigip@v0.0.0-20220119082918-5f215f878998/bigip.go:177 +0x7e github.com/f5devcentral/go-bigip.(BigIP).getForEntity(0x0, 0xe8c300, 0xc0001052c0, 0xc0005d5328, 0x4, 0x4, 0xa, 0xe9c080, 0xc00000e6b8) github.com/f5devcentral/go-bigip@v0.0.0-20220119082918-5f215f878998/bigip.go:451 +0xe6 github.com/f5devcentral/go-bigip.(BigIP).getAs3version(0x0, 0x40a, 0x480, 0xe9c080) github.com/f5devcentral/go-bigip@v0.0.0-20220119082918-5f215f878998/as3bigip.go:301 +0xfb github.com/f5devcentral/go-bigip.(BigIP).AddTeemAgent(0x0, 0xeb9760, 0xc0005d5600, 0xeb9760, 0xc00033d7b0, 0x0, 0x0) github.com/f5devcentral/go-bigip@v0.0.0-20220119082918-5f215f878998/as3bigip.go:439 +0x116 github.com/F5Networks/terraform-provider-bigip/bigip.resourceBigipAs3Create(0xc0005a2770, 0x10262e0, 0x0, 0x0, 0x0) github.com/F5Networks/terraform-provider-bigip/bigip/resource_bigip_as3.go:185 +0x35c github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).Apply(0xc000172100, 0xc000645e00, 0xc0005883e0, 0x10262e0, 0x0, 0xefd701, 0xc000405af8, 0xc0005a9650) github.com/hashicorp/terraform-plugin-sdk@v1.1.0/helper/schema/resource.go:305 +0x375 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Provider).Apply(0xc000172900, 0xc0005d58e8, 0xc000645e00, 0xc0005883e0, 0xc000405b68, 0xc00000e448, 0xeff4c0) github.com/hashicorp/terraform-plugin-sdk@v1.1.0/helper/schema/provider.go:294 +0x99 github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0xc00000e1d0, 0x11ba050, 0xc0005a8c30, 0xc000372540, 0xc00000e1d0, 0xc0005a8c30, 0xc000567a50) github.com/hashicorp/terraform-plugin-sdk@v1.1.0/internal/helper/plugin/grpc_provider.go:885 +0x8a5 github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xfe5160, 0xc00000e1d0, 0x11ba050, 0xc0005a8c30, 0xc0003724e0, 0x0, 0x11ba050, 0xc0005a8c30, 0xc0005aec80, 0xc66) github.com/hashicorp/terraform-plugin-sdk@v1.1.0/internal/tfplugin5/tfplugin5.pb.go:3189 +0x214 google.golang.org/grpc.(Server).processUnaryRPC(0xc0000ee160, 0x11c2838, 0xc000376d80, 0xc00050d200, 0xc00036e5d0, 0x171fca0, 0x0, 0x0, 0x0) google.golang.org/grpc@v1.23.0/server.go:995 +0x482 google.golang.org/grpc.(Server).handleStream(0xc0000ee160, 0x11c2838, 0xc000376d80, 0xc00050d200, 0x0) google.golang.org/grpc@v1.23.0/server.go:1275 +0xd2c google.golang.org/grpc.(Server).serveStreams.func1.1(0xc0005041c0, 0xc0000ee160, 0x11c2838, 0xc000376d80, 0xc00050d200) 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.2 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.

Operation failed: failed running terraform apply (exit 1)

Expected Behavior

A clear and concise description of what you expected to happen.

Actual Behavior

Terraform provider crash

pgouband commented 2 months ago

Hi @JPatC,

It seems the issue occurs when Terraform is managing AS3 resource. Can you share the AS3 json and if there is anything specific in TF AS3 resource?

JPatC commented 2 months ago

Here's our JSON CODE. we do some variable substitution that's sensitive.

{ "class": "AS3", "action": "deploy", "persist": true, "declaration": { "class": "ADC", "schemaVersion": "3.0.0", "id": "declaration-baseline", "label": "${lc_spell} Baseline Declaration", "remark": "Tenants creation, defining Pools and main HTTP redirect.", "${lc_abbv}-cint": { "class": "Tenant", "defaultRouteDomain": 0, "baseline": { "class": "Application", "template": "shared", "${lc_abbv}-http-redirect" : { "class": "Service_HTTP", "description" : "${lc_spell} ECE HTTP to HTTPS redirect", "virtualAddresses": [ "${public_ip}" ], "virtualPort" : 80, "profileTCP" : { "bigip" : "/Common/tcp" }, "persistenceMethods" : [], "iRules" : [{"bigip" : "/Common/_sys_https_redirect"}] }, "${lc_abbv}-cint-tls-server" : { "class" : "TLS_Client", "clientCertificate" : "${lc_abbv}-ece-wildcard" }, "${lc_abbv}-cint-tls" : { "class" : "TLS_Server", "certificates" : [ { "certificate" : "${lc_abbv}-ece-wildcard" } ] }, "${lc_abbv}-ece-wildcard" : { "class" : "Certificate", "certificate" : "${crt}", "privateKey" : "${key}", "chainCA" : { "text" : "${ca}" } } } } } }