@@ -447,7 +447,7 @@ func (s *IdentityTagResourceCrud) Delete() error {
447447func IdentityTaggingWaitForWorkRequest (workRequestId * string , entityType string , action oci_identity.WorkRequestResourceActionTypeEnum ,
448448 timeout time.Duration , disableFoundRetries bool , client * oci_identity.IdentityClient ) (* string , error ) {
449449 retryPolicy := GetRetryPolicy (disableFoundRetries , "identity" )
450- retryPolicy .ShouldRetryOperation = analyticsInstanceWorkRequestShouldRetryFunc (timeout )
450+ retryPolicy .ShouldRetryOperation = identityTagWorkRequestShouldRetryFunc (timeout )
451451 response := oci_identity.GetTaggingWorkRequestResponse {}
452452 stateConf := & resource.StateChangeConf {
453453 Pending : []string {
@@ -635,3 +635,26 @@ func getIdentityTagCompositeId(tagName string, tagNamespaceId string) string {
635635 compositeId := "tagNamespaces/" + tagNamespaceId + "/tags/" + tagName
636636 return compositeId
637637}
638+
639+ func identityTagWorkRequestShouldRetryFunc (timeout time.Duration ) func (response oci_common.OCIOperationResponse ) bool {
640+ startTime := time .Now ()
641+ stopTime := startTime .Add (timeout )
642+ return func (response oci_common.OCIOperationResponse ) bool {
643+
644+ // Stop after timeout has elapsed
645+ if time .Now ().After (stopTime ) {
646+ return false
647+ }
648+
649+ // Make sure we stop on default rules
650+ if shouldRetry (response , false , "identity" , startTime ) {
651+ return true
652+ }
653+
654+ // Only stop if the time Finished is set
655+ if workRequestResponse , ok := response .Response .(oci_identity.GetWorkRequestResponse ); ok {
656+ return workRequestResponse .TimeFinished == nil
657+ }
658+ return false
659+ }
660+ }
0 commit comments