Indonesia's parliament on Tuesday approved legislation that penalises sex outside of marriage with one year of imprisonment.