If the roof consists of raw wood paneling, which is then covered with felt and fitted with roof tiles, it is possible to attach to the paneling. Preferably use fittings that are adapted for this and distribute the weight on the backside.
Alternatively, you can fasten the entire structure to the rafters.
Considering that the terrace will be used for stepping out onto, you should contact an engineer to construct it for you so it is safe to use.
It is also important to ensure that the roof is watertight.