From f7fd1d8ba2b790115e6fcbe3a0162c16aea8d674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Mon, 26 Aug 2024 15:12:44 +0300 Subject: [PATCH 1/2] Ignore late initialize for scaling_config in NodeGroup resource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken --- apis/eks/v1beta1/zz_nodegroup_terraformed.go | 1 + apis/eks/v1beta2/zz_nodegroup_terraformed.go | 1 + config/eks/config.go | 1 + 3 files changed, 3 insertions(+) diff --git a/apis/eks/v1beta1/zz_nodegroup_terraformed.go b/apis/eks/v1beta1/zz_nodegroup_terraformed.go index b7c9990a65..b418df09e0 100755 --- a/apis/eks/v1beta1/zz_nodegroup_terraformed.go +++ b/apis/eks/v1beta1/zz_nodegroup_terraformed.go @@ -119,6 +119,7 @@ func (tr *NodeGroup) LateInitialize(attrs []byte) (bool, error) { } opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} opts = append(opts, resource.WithNameFilter("ReleaseVersion")) + opts = append(opts, resource.WithNameFilter("ScalingConfig")) opts = append(opts, resource.WithNameFilter("Version")) li := resource.NewGenericLateInitializer(opts...) diff --git a/apis/eks/v1beta2/zz_nodegroup_terraformed.go b/apis/eks/v1beta2/zz_nodegroup_terraformed.go index dfe2640072..2a605034bd 100755 --- a/apis/eks/v1beta2/zz_nodegroup_terraformed.go +++ b/apis/eks/v1beta2/zz_nodegroup_terraformed.go @@ -119,6 +119,7 @@ func (tr *NodeGroup) LateInitialize(attrs []byte) (bool, error) { } opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} opts = append(opts, resource.WithNameFilter("ReleaseVersion")) + opts = append(opts, resource.WithNameFilter("ScalingConfig")) opts = append(opts, resource.WithNameFilter("Version")) li := resource.NewGenericLateInitializer(opts...) diff --git a/config/eks/config.go b/config/eks/config.go index 8ceadb8810..2466910f5f 100644 --- a/config/eks/config.go +++ b/config/eks/config.go @@ -54,6 +54,7 @@ func Configure(p *config.Provider) { IgnoredFields: []string{ "release_version", "version", + "scaling_config", }, } r.UseAsync = true From a5e5471dde1b792007712bb20739e8a43b60bd61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Wed, 28 Aug 2024 15:24:04 +0300 Subject: [PATCH 2/2] Move scaling_config field to ConditionalIgnoredFields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken --- apis/eks/v1beta1/zz_nodegroup_terraformed.go | 6 +++++- apis/eks/v1beta2/zz_nodegroup_terraformed.go | 6 +++++- config/eks/config.go | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apis/eks/v1beta1/zz_nodegroup_terraformed.go b/apis/eks/v1beta1/zz_nodegroup_terraformed.go index b418df09e0..81d919d9da 100755 --- a/apis/eks/v1beta1/zz_nodegroup_terraformed.go +++ b/apis/eks/v1beta1/zz_nodegroup_terraformed.go @@ -119,8 +119,12 @@ func (tr *NodeGroup) LateInitialize(attrs []byte) (bool, error) { } opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} opts = append(opts, resource.WithNameFilter("ReleaseVersion")) - opts = append(opts, resource.WithNameFilter("ScalingConfig")) opts = append(opts, resource.WithNameFilter("Version")) + initParams, err := tr.GetInitParameters() + if err != nil { + return false, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + opts = append(opts, resource.WithConditionalFilter("ScalingConfig", initParams)) li := resource.NewGenericLateInitializer(opts...) return li.LateInitialize(&tr.Spec.ForProvider, params) diff --git a/apis/eks/v1beta2/zz_nodegroup_terraformed.go b/apis/eks/v1beta2/zz_nodegroup_terraformed.go index 2a605034bd..6e93fb598d 100755 --- a/apis/eks/v1beta2/zz_nodegroup_terraformed.go +++ b/apis/eks/v1beta2/zz_nodegroup_terraformed.go @@ -119,8 +119,12 @@ func (tr *NodeGroup) LateInitialize(attrs []byte) (bool, error) { } opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} opts = append(opts, resource.WithNameFilter("ReleaseVersion")) - opts = append(opts, resource.WithNameFilter("ScalingConfig")) opts = append(opts, resource.WithNameFilter("Version")) + initParams, err := tr.GetInitParameters() + if err != nil { + return false, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + opts = append(opts, resource.WithConditionalFilter("ScalingConfig", initParams)) li := resource.NewGenericLateInitializer(opts...) return li.LateInitialize(&tr.Spec.ForProvider, params) diff --git a/config/eks/config.go b/config/eks/config.go index 2466910f5f..9f0bdce95d 100644 --- a/config/eks/config.go +++ b/config/eks/config.go @@ -54,6 +54,8 @@ func Configure(p *config.Provider) { IgnoredFields: []string{ "release_version", "version", + }, + ConditionalIgnoredFields: []string{ "scaling_config", }, }