From f99dee311532b400cdc81c464fd69c4c7e52a582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergen=20Yal=C3=A7=C4=B1n?= Date: Tue, 5 Dec 2023 17:15:44 +0300 Subject: [PATCH] Pass default and configured timeouts to InstanceState for using the timeouts while Observe calls 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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/controller/external_nofork.go b/pkg/controller/external_nofork.go index 3bcd674b..bd4d601f 100644 --- a/pkg/controller/external_nofork.go +++ b/pkg/controller/external_nofork.go @@ -227,7 +227,7 @@ func (c *NoForkConnector) applyStateFuncToParam(sc *schema.Schema, param any) an return param } -func (c *NoForkConnector) Connect(ctx context.Context, mg xpresource.Managed) (managed.ExternalClient, error) { +func (c *NoForkConnector) Connect(ctx context.Context, mg xpresource.Managed) (managed.ExternalClient, error) { //nolint:gocyclo c.metricRecorder.ObserveReconcileDelay(mg.GetObjectKind().GroupVersionKind(), mg.GetName()) logger := c.logger.WithValues("uid", mg.GetUID(), "name", mg.GetName(), "gvk", mg.GetObjectKind().GroupVersionKind().String()) logger.Debug("Connecting to the service provider") @@ -279,6 +279,17 @@ func (c *NoForkConnector) Connect(ctx context.Context, mg xpresource.Managed) (m } s.RawPlan = tfStateCtyValue s.RawConfig = rawConfig + + timeouts := getTimeoutParameters(c.config) + if len(timeouts) > 0 { + if s == nil { + s = &tf.InstanceState{} + } + if s.Meta == nil { + s.Meta = make(map[string]interface{}) + } + s.Meta[schema.TimeoutKey] = timeouts + } opTracker.SetTfState(s) }