We consider a student-project-resource matching-allocation problem, in which students (resp. resources) are matched (resp. allocated) to projects. A project's capacity for students is endogenously determined by the resources allocated to it. Traditionally, (1) resources are allocated to projects based on some expectations, and then (2) students are matched with projects based on the capacities determined by (1). Although resource allocation and two-sided matching are well-understood, unless the expectations used in the first problem are correct, we obtain a suboptimal outcome. Thus, it is desirable to solve this problem as a whole without dividing it. In this paper, we show that finding a nonwasteful matching is FPNP [log]-hard, and that deciding whether a stable matching (i.e. nonwasteful and fair) exists is NPNP-complete. We also show that no strategyproof mechanism can satisfy fairness and very weak efficiency requirements. Then, we develop a new strategyproof mechanism, called Sample and Vote Deferred Acceptance (SVDA), that strikes a good balance between fairness and efficiency.