Skip to content

Commit

Permalink
Pass default and configured timeouts to InstanceState for using the t…
Browse files Browse the repository at this point in the history
…imeouts while Observe calls

Signed-off-by: Sergen Yalçın <[email protected]>
  • Loading branch information
sergenyalcin committed Dec 5, 2023
1 parent ca2cfe6 commit f99dee3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/controller/external_nofork.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit f99dee3

Please sign in to comment.