I am a race bike beginner and I am considering to buy a road bike. Is it doable to ride a road bike for an Ironman race or should I consider a Time-Trial bike?
It largely depends on your level of ambition for how you want to perform at the event.
You will need a road bike regardless, as you will perform the bulk of your training on it (likely 8-10hrs/wk for an ironman) in addition to potentially being your event bike too.
However if you are looking at doing a <6hr bike split then a Triathlon bike with a nice set of deep section wheels is going to be a significant advantage.
I suggest buying a regular road bike, have it properly fit and ride it.
It will be good enough for a couple of years in all situations, not just triathlons.
You can upgrade it with some aero bars, better wheels and tyres.
Riders do do triathlons of varying distances on road racing oriented road bikes that are not full-on tri or aero bikes. Often they fit bolt on aero bars.
What you should be aware of is that not all drop bar road bikes are the same. There is the obvious level of components, weight and cost, but there are also differences in geometry. Some have a more relaxed, upright riding position and some are more aggressive. If you want to race you should probably look for bike with a more aggressive geometry.
Do some research to find out what models of bikes would be suitable. Go do some test rides at local bike shops. If you are starting out the used bike marketplace is also a great resource.
Bicycling is generally the longest as well as the most technical part of an Ironman, in the sense that the outcome depends to a large extent on the quality of the equipment you have and not purely on talent. Since it is the longest, if the equipment is not the optimal one, the time gap between you and others would increase. You say that you are a beginner and in that sense, assuming you are not aiming to be the fastest, then a road bike would definitely be not much different from a TTR in terms of effort. It would be a good experience. Having run only one ironman in my life and that too at 35 deg C, I took close to 9 hours (only for the cycling part)struggling on a road bike that was too big for me. If I were to do it again, I would definitely get a proper road bike, build up my fitness and comfort level more and then move on to a TTR. All the best.