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]: RDS Parameter Group updates parameter in loop #1286

Open WolfGanGeRTech opened 2 months ago

WolfGanGeRTech commented 2 months ago

Is there an existing issue for this?

Affected Resource(s)

ParameterGroup.rds.aws.upbound.io

Resource MRs required to reproduce the bug

ParameterGroup.rds.aws.upbound.io

Steps to Reproduce

Create a new ParameterGroup for mysql 8.0 and set the property "innodb_file_per_table": 1

apiVersion: rds.aws.upbound.io/v1beta1
kind: ParameterGroup
metadata:
  name: example-parametergroup
spec:
  forProvider:
    description: example
    family: mysql8.0
    parameter:
      - applyMethod: immediate
        name: innodb_file_per_table
        value: "1"
    region: eu-central-1

Crossplane will start updating AWS in loop, this increases a lot the Cloudtrail costs.

image

What happened?

When a new RDS parameter group is created with property "innodb_file_per_table": 1, crossplane tries to apply this config in loop increasing a lot the cloudtrail costs.

image

I have used a few properties and this is the only one that is returning this problem, however I can not guarantee this is the only property that causes problems.

When I look at cloudtrail:

image

The request shows "isModifiable": false, however this parameter shows as modifiable in the parameter group table:

image

So I am not sure this is the issue.

Relevant Error Output Snippet

No errors seen in Crossplane.

Crossplane Version

12.2.2

Provider Version

0.46

Kubernetes Version

1.27

Kubernetes Distribution

EKS

Additional Info

No response

WolfGanGeRTech commented 2 months ago

I was able to find the issue, basically this property doesn't allow setting the applyMethod to "immediate" (which is the default on Crossplane). So Crossplane tries to apply it and AWS gives an Ok, however doesn't really change the value, so Crossplane tries again and again.

In these cases it would be good if we could define a retry interval cause a small error in the configs can lead to huge costs.

turkenf commented 1 month ago

Hi @WolfGanGeRTech,

Thank you for raising this issue it can be reproducible with the provider version 1.4.0:

2024-05-09T12:21:34+03:00   DEBUG   provider-aws    Diff detected   {"uid": "f57f26a5-4e88-4fcb-bef0-74d8dd0d0719", "name": "fatih-example-parametergroup", "gvk": "rds.aws.upbound.io/v1beta1, Kind=ParameterGroup", "instanceDiff": "*terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{\"parameter.178632114.apply_method\":*terraform.ResourceAttrDiff{Old:\"\", New:\"immediate\", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, \"parameter.178632114.name\":*terraform.ResourceAttrDiff{Old:\"\", New:\"innodb_file_per_table\", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, \"parameter.178632114.value\":*terraform.ResourceAttrDiff{Old:\"\", New:\"1\", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, \"parameter.2584704414.apply_method\":*terraform.ResourceAttrDiff{Old:\"pending-reboot\", New:\"\", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, \"parameter.2584704414.name\":*terraform.ResourceAttrDiff{Old:\"innodb_file_per_table\", New:\"\", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, \"parameter.2584704414.value\":*terraform.ResourceAttrDiff{Old:\"1\", New:\"\", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, RawConfig:cty.NilVal, RawState:cty.NilVal, RawPlan:cty.NilVal, Meta:map[string]interface {}(nil)}"}