Do you want to move to Spain? Does he want you to go with him? I dont blame you for not wanting to do long distance. Do you want to end it before he ends it with you??? I dont understand that part. If you want to go with him... then go.
If you aren't willing to put the effort into making your relationship work for a temporary separation - especially considering all the technology we have these days in order to keep in close contact with each other even through long distances, then you are probably better of breaking up now.
People (especially in the military) endure long separations all the time, if you love each other and want to make it work, then you deal with it.
It is the matter that you can talk it over with your boyfriend and find ways that you can go about it. If you feel that you need to move with him to Spain, then it is a matter that needs discussion. You may also choose between visiting him within some given time, depending on how you shall agree upon.