Short answer. Yes. Civil Code Article 935 lets you forgive a debt owed to you by leaving its remission as a legacy, but only for the part of the debt still outstanding when you die. The estate gives the legatee a document acquitting the debt on request, and any interest due at your death is forgiven too.
What the law says
The legacy of a credit against a third person or of the remission or release of a debt of the legatee shall be effective only as regards that part of the credit or debt existing at the time of the death of the testator.
Civil Code, Article 935 — Legacy of a Credit or a Remission of Debt. Read the full provision →
What the law says
In both cases, the legacy shall comprise all interests on the credit or debt which may be due the testator at the time of his death.
Civil Code, Article 935 — Legacy of a Credit or a Remission of Debt. Read the full provision →
What a legacy of remission actually forgives
Article 935 covers exactly this situation, alongside a related one: the legacy of a credit against a third person or of the remission or release of a debt of the legatee shall be effective only as regards that part of the credit or debt existing at the time of the death of the testator. The key limit is timing. If the legatee has already paid off part of the debt before you die, that part is gone from the legacy — you can only forgive what is still owed to you at the moment of your death.
Two different legacies live in the same article
The article groups two situations together: forgiving a debt the legatee themselves owes you, and leaving someone a credit you are owed by a third party. They are discharged differently. For a credit against a third person, the estate complies by assigning the legatee all the rights of action it has against that debtor. For a remission of the legatee's own debt, the estate instead gives the legatee an acquittance — a formal discharge — if the legatee asks for one.
Interest is forgiven along with the principal
You do not need to separately mention interest for it to be covered. The article states that in both cases, the legacy shall comprise all interests on the credit or debt which may be due the testator at the time of his death. So whatever interest had accrued and was owed to you by the time you died is wiped out along with the principal balance, without needing extra wording in the will to say so.
What to keep clear when you draft this
Identify the debt precisely in the will — who owes it, roughly what it covers, and any documentation that establishes it, since only the balance actually outstanding at your death is forgiven. If the legatee has been making payments, that running balance is what will matter, not the original amount you lent. Keep your own records of the debt current, and talk to a lawyer about how this legacy should be worded so the estate can identify and discharge it without dispute.