chore: work save

This commit is contained in:
Marcel S. Henselin 2026-01-27 16:43:53 +01:00
parent a60b1db1f4
commit 3e3f13d36d
7 changed files with 214 additions and 46 deletions

View file

@ -24,7 +24,7 @@ const (
InstanceStateFailed = "Failed"
)
// Interface needed for tests
// APIClientInstanceInterface Interface needed for tests
type APIClientInstanceInterface interface {
GetInstanceRequestExecute(ctx context.Context, projectId, region, instanceId string) (*sqlserverflex.GetInstanceResponse, error)
}
@ -53,6 +53,10 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface
case strings.ToLower(InstanceStateUnknown), strings.ToLower(InstanceStateFailed):
return true, s, fmt.Errorf("create failed for instance with id %s", instanceId)
default:
tflog.Info(ctx, "Wait (create) received unknown status", map[string]interface{}{
"instanceId": instanceId,
"status": s.Status,
})
return false, s, nil
}
})
@ -77,10 +81,14 @@ func UpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface
case strings.ToLower(InstanceStateUnknown), strings.ToLower(InstanceStateFailed):
return true, s, fmt.Errorf("update failed for instance with id %s", instanceId)
default:
tflog.Info(ctx, "Wait (update) received unknown status", map[string]interface{}{
"instanceId": instanceId,
"status": s.Status,
})
return false, s, nil
}
})
handler.SetSleepBeforeWait(2 * time.Second)
handler.SetSleepBeforeWait(15 * time.Second)
handler.SetTimeout(45 * time.Minute)
return handler
}