HOA Restrictions

We have a 3 bed Home and unfortunately lost the job. We want to rent 2 rooms on a single or sharing basis to help pay the mortgage. However HOA has a restriction of maximum 2 unrelated persons living as a single family Home. Additionally, they have a restriction on additional number of cars parked. Is this valid/legal or enforceable? Because of this restrictions, it seems we can not rent the rooms. Texas.