hi,
Array size can be changed through generics to make your design scalable. But you can not create dynamic array which size depends on signal or port value.
Here is my suggestion:
Create array of length equal to your maximum wanted delay. Generate in series connected registers (input of first register is your wanted to delay signal, input of next register is connected to previous register output and so on). Then use mux to select one of the register outputs.
But take in mind that if you are planing to use large array this will require large mux which will give delays trough comb elements in real hardware.