It is haram to make a will against the rules of Allah. The rules of Allah are to be followed to the letter of the law.
Dr. MonzerKahf, a prominent economist and counselor states: “It is not permissible. Rather it is a big sin because it is in direct contradiction with the Qur’an. Allah divides in the Qur’an, mainly in Surah number 4, the estate of a person when she/he dies and made this division mandatory. Please read the Verses 10-14 of this Surah. Therefore, if you neither have children nor parents, when you die all your property should be divided between your brothers and sisters, two shares to a brother and one share to a sister.
The Islamic belief is based on a basic principle that We all belong to Allah, the Creator and Master of the Worlds, so when we die the property that He gave us while alive goes back to HIS OWNERSHIP and He divides it the Way He prescribed in the Qur’an.
However, our beloved Prophet (peace and blessings be upon him) told us that Allah permits us to assign a maximum of only one third of our property (net of all debts and expenses) for distribution to charity and the like provided we do not assign any portion to an heir since such an assignment disturbs the distribution given in the Qur’an. In fact, if you live in a country that has a Shari’ah based inheritance law (e.g., all Arab countries and all Muslim majority countries except Turkey, India, Singapore and several other Muslim majority countries that have Muslim family law for Muslims), such a Last Will (as you mentioned in the question) is legally invalid and will be trashed away by law at the time of death.”