From 280b4b0fdd1f0d78181fa0f88b03c6a4aa1492ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergen=20Yal=C3=A7=C4=B1n?= Date: Fri, 3 Nov 2023 16:37:55 +0300 Subject: [PATCH] Add nil check for instanceDiff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergen Yalçın --- pkg/controller/external_nofork.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/controller/external_nofork.go b/pkg/controller/external_nofork.go index 78a91954..e580e29c 100644 --- a/pkg/controller/external_nofork.go +++ b/pkg/controller/external_nofork.go @@ -409,10 +409,13 @@ func (n *noForkExternal) getResourceDataDiff(tr resource.Terraformed, ctx contex instanceDiff.RawConfig = n.rawConfig } timeouts := getTimeoutParameters(n.config) - if instanceDiff.Meta == nil && len(timeouts) > 0 { - instanceDiff.Meta = make(map[string]interface{}) - } if len(timeouts) > 0 { + if instanceDiff == nil { + instanceDiff = tf.NewInstanceDiff() + } + if instanceDiff.Meta == nil { + instanceDiff.Meta = make(map[string]interface{}) + } instanceDiff.Meta[schema.TimeoutKey] = timeouts } return instanceDiff, nil