crossplane-contrib / provider-upjet-aws

Official AWS Provider for Crossplane by Upbound.
https://marketplace.upbound.io/providers/upbound/provider-aws
Apache License 2.0
137 stars 112 forks source link

[Bug]: ELBv2 Provider v1.5.0+ LBListener 'panic' #1352

Open lajchon opened 3 weeks ago

lajchon commented 3 weeks ago

Is there an existing issue for this?

Affected Resource(s)

elbv2.aws.upbound.io/v1beta1, Kind=LBListener

Resource MRs required to reproduce the bug

---
apiVersion: elbv2.aws.upbound.io/v1beta1
kind: LBListener
metadata:
  name: https
spec:
  deletionPolicy: Delete
  forProvider:
    region: us-east-1
    protocol: TCP
    port: 443
    defaultAction:
      - type: forward
        targetGroupArn: validTargetGroupArn
    loadBalancerArn: validLoadBalancerArn

Steps to Reproduce

Deploy elbv2.aws.upbound.io/v1beta1 LB, LBTargetGroup and LBListener with v1.4.0 is successful. Bump elbv2 Provider version to v1.5.0 or v1.6.0, an Observed a panic: value is null is logged

What happened?

After bumping version from v1.4.0 to v1.5.0+, the following is logged for existing LBListener:

2024-06-10T18:41:57Z    DEBUG   provider-aws    Observing the external resource {"uid": "838a6eb0-7742-4b8c-ab9f-2163e6a7290b", "name": "use1-sandbox-primary-internal-j6h86-6xnx2", "gvk": "elbv2.aws.upbound.io/v1beta1, Kind=LBListener"}
E0610 18:41:57.677193       1 runtime.go:77] Observed a panic: value is null
goroutine 3841 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic({0x134f03a0, 0x1936c980})
    k8s.io/apimachinery@v0.29.4/pkg/util/runtime/runtime.go:75 +0x85
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
    sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:108 +0xb2
panic({0x134f03a0?, 0x1936c980?})
    runtime/panic.go:770 +0x132
github.com/hashicorp/go-cty/cty.Value.LengthInt({{{0x195976d8?, 0xc00bdb2290?}}, {0x0?, 0x0?}})
    github.com/hashicorp/go-cty@v1.4.1-0.20200723130312-85980079f637/cty/value_ops.go:989 +0x258
github.com/hashicorp/terraform-provider-aws/internal/service/elbv2.flattenLbForwardActionOneOf({{{0x195976d8?, 0xc00bdb22e0?}}, {0x130d90a0?, 0xc00bce7d10?}}, 0x0, {{0xc00c7f38e0, 0x7}, 0x0, 0x0, 0x0, ...}, ...)
    github.com/hashicorp/terraform-provider-aws@v0.0.0-00010101000000-000000000000/internal/service/elbv2/listener.go:1036 +0x1de
github.com/hashicorp/terraform-provider-aws/internal/service/elbv2.flattenLbForwardAction(0xc00d1e8400, {0x16800240, 0xe}, 0x0, {{0xc00c7f38e0, 0x7}, 0x0, 0x0, 0x0, 0xc0052f3b30, ...}, ...)
    github.com/hashicorp/terraform-provider-aws@v0.0.0-00010101000000-000000000000/internal/service/elbv2/listener.go:1014 +0x22b
github.com/hashicorp/terraform-provider-aws/internal/service/elbv2.flattenLbListenerActions(0xc00d1e8400, {0x16800240, 0xe}, {0xc00cce80f0?, 0x1, 0x41a085?})
    github.com/hashicorp/terraform-provider-aws@v0.0.0-00010101000000-000000000000/internal/service/elbv2/listener.go:979 +0x2c5
github.com/hashicorp/terraform-provider-aws/internal/service/elbv2.resourceListenerRead({0x19596cf8, 0xc005270d20}, 0xc00d1e8400, {0x167734a0?, 0xc00271c000?})
    github.com/hashicorp/terraform-provider-aws@v0.0.0-00010101000000-000000000000/internal/service/elbv2/listener.go:535 +0x5db
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).Read.interceptedHandler[...].func9(0xc00d1e8400?, {0x167734a0?, 0xc00271c000})
    github.com/hashicorp/terraform-provider-aws@v0.0.0-00010101000000-000000000000/internal/provider/intercept.go:113 +0x283
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x19596da0?, {0x19596da0?, 0xc00ce11490?}, 0xd?, {0x167734a0?, 0xc00271c000?})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:790 +0x7a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc001e25b20, {0x19596da0, 0xc00ce11490}, 0xc00198c820, {0x167734a0, 0xc00271c000})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:1089 +0x529
github.com/crossplane/upjet/pkg/controller.(*terraformPluginSDKExternal).Observe(0xc00ba9ddc0, {0x19596da0, 0xc00ce11490}, {0x1969ab10, 0xc00cd0d508})
    github.com/crossplane/upjet@v1.4.0/pkg/controller/external_tfpluginsdk.go:472 +0x173
github.com/crossplane/upjet/pkg/controller.(*terraformPluginSDKAsyncExternal).Observe(0xc00d23c1e0, {0x19596da0, 0xc00ce11490}, {0x1969ab10, 0xc00cd0d508})
    github.com/crossplane/upjet@v1.4.0/pkg/controller/external_async_tfpluginsdk.go:127 +0xc5
github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile(0xc00a9b2f00, {0x19596cf8, 0xc005085440}, {{{0x0, 0x0}, {0xc0070bc690, 0x29}}})
    github.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/reconciler/managed/reconciler.go:914 +0x2150
github.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile(0xc006636640, {0x19596cf8, 0xc005085440}, {{{0x0?, 0x5?}, {0xc0070bc690?, 0xc00cb99d10?}}})
    github.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/ratelimiter/reconciler.go:54 +0x151
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x195b60d8?, {0x19596cf8?, 0xc005085440?}, {{{0x0?, 0xb?}, {0xc0070bc690?, 0x0?}}})
    sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119 +0xb7
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0065aee60, {0x19596d30, 0xc0013d3b80}, {0x15172980, 0xc00ce0f2e0})
    sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316 +0x3bc
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0065aee60, {0x19596d30, 0xc0013d3b80})
    sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266 +0x1be
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
    sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227 +0x79
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 3650
    sigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:223 +0x50c

When attempting to create a new Listener with elbv2 v1.5.0, Listeners are created correctly and associated with Load-Balancer, but the following status is eventually returned:

status:
  atProvider: {}
  conditions:
    - lastTransitionTime: '2024-06-10T18:52:32Z'
      reason: Creating
      status: 'False'
      type: Ready
    - lastTransitionTime: '2024-06-10T18:54:30Z'
      message: >-
        cannot patch the managed resource via server-side apply:
        LBListener.elbv2.aws.upbound.io
        "use1-sandbox-primary-internal-j6h86-nv9z8" is invalid: spec: Invalid
        value: "object": spec.forProvider.defaultAction is a required parameter
      reason: ReconcileError
      status: 'False'
      type: Synced
    - lastTransitionTime: '2024-06-10T18:54:30Z'
      message: >-
        async create failed: failed to create the resource: [{0 creating ELBv2
        Listener (): operation error Elastic Load Balancing v2: CreateListener,
        https response error StatusCode: 400, RequestID:
        677dd570-2c5f-4a16-9644-44ce704005f7, api error ValidationError: The
        input parameters provided are not supported  []}]
      reason: AsyncCreateFailure
      status: 'False'
      type: LastAsyncOperation

Relevant Error Output Snippet

No response

Crossplane Version

1.16.0

Provider Version

1.5.0

Kubernetes Version

No response

Kubernetes Distribution

No response

Additional Info

No response

turkenf commented 2 weeks ago

Hi @lajchon,

Thank you for the report, is the issue also reproducible in provider v1.7.0?

lajchon commented 2 weeks ago

@turkenf , it appears to still be an issue after updating the provider to v1.7.0.

Justin-DynamicD commented 1 week ago

Adding voice to this issue. It also occurs in 1.6.0 and 1.6.1 as well.

In our scenario, the LBListener can cause it to crash within 5sec or so.