Skip to content

Commit

Permalink
modified timeout for subaccount subscription (#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
diya-dhan authored Jul 17, 2024
1 parent 405ec90 commit d78a61a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions internal/provider/resource_subaccount_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ func (rs *subaccountSubscriptionResource) Create(ctx context.Context, req resour
return
}

timeout := 60 * time.Minute
delay, minTimeout := tfutils.CalculateDelayAndMinTimeOut(timeout)

createStateConf := &tfutils.StateChangeConf{
Pending: []string{saas_manager_service.StateInProcess},
Target: []string{saas_manager_service.StateSubscribed},
Expand All @@ -245,9 +248,9 @@ func (rs *subaccountSubscriptionResource) Create(ctx context.Context, req resour

return subRes, subRes.State, nil
},
Timeout: 10 * time.Minute,
Delay: 5 * time.Second,
MinTimeout: 5 * time.Second,
Timeout: timeout,
Delay: delay,
MinTimeout: minTimeout,
}

updatedRes, err := createStateConf.WaitForStateContext(ctx)
Expand Down Expand Up @@ -291,6 +294,9 @@ func (rs *subaccountSubscriptionResource) Delete(ctx context.Context, req resour
return
}

timeout := 60 * time.Minute
delay, minTimeout := tfutils.CalculateDelayAndMinTimeOut(timeout)

deleteStateConf := &tfutils.StateChangeConf{
Pending: []string{saas_manager_service.StateInProcess},
Target: []string{saas_manager_service.StateNotSubscribed},
Expand All @@ -308,9 +314,9 @@ func (rs *subaccountSubscriptionResource) Delete(ctx context.Context, req resour

return subRes, subRes.State, nil
},
Timeout: 10 * time.Minute,
Delay: 5 * time.Second,
MinTimeout: 5 * time.Second,
Timeout: timeout,
Delay: delay,
MinTimeout: minTimeout,
}

_, err = deleteStateConf.WaitForStateContext(ctx)
Expand Down

0 comments on commit d78a61a

Please sign in to comment.