I want to root SG S7 Edge. I have not installed twrp. Once I install twrp, all I want is root acess not custom roms or whatever. My question is if I only will install Magisk, do I need to wipe. If yes, what is the bare minimum I need to wipe. I don't want to do a full wipe if I don't have to. (I am refering to the wipe on twrp)
When installing Magisk you don't need to wipe anything (data, dalvik, cache, system, etc). All you need is to install the Magisk zip.
If you want to install a custom ROM, then it is recommended to wipe data, system and dalvik/cache.
I'd personally recommend a full wipe, as that gives you the best chance to avoid weird bugs forcing you to do a factory reset later on anyways, even if you are just aiming to use Magisk. Wiping the Dalvik partition and cache alone, however, should be fine to perform without loss of data, as those are both files that the system maintains to reduce loading times for apps and such - if they are missing, the system will just regenerate them the next time you load that app, and clearing it out to begin with can mitigate hangups.
If you flash TWRP then there is a lot of work. You need to disable recovery-from-boot dm-verity and vaultkeeper. Besides this TWRP is not able to decrypt encrypted data partition by default.
I am not sure if flashing Magisk from TWRP works with unmountable data partition (magisk stores files inside /data/adb).
If you don't want to factory reset, i recommend to install Magisk Manager app and root without flashing TWRP. The app patches your boot image, so most of the work is done.
However, regarding vaultkeeper there is still a high risk you may brick your device. OEM unlocking once is not enough, you have to unlock it twice in a 3 step way. topjohnwu wrote a description how it works for the Galaxy S10. I am not sure if this also concerns your device today, but sure it will in the future