Is terrorism ever justified?
Good question. Someone who is a consequentialist --that is, a person who believes the morality of an act is contingent on its actual or expected consequences such as the act's producing great happiness or unhappiness-- might have to answer "yes." This is because there are probably cases (or there could be hypothetical cases) when an act of terrorism will produce some greater good or avoid some otherwise inevitable horror and there is no other act available to the parties involved. It is this implication of consequentialism that compels some of us to reject it. Some of us think there are what might be called absolute evils, evil that is so awful that one must not perform the evil no matter what ("even if the heavens fall" or something like that, is an expression sometimes used here). I believe Gandhi once observed that if he had to choose between two evils, he would choose neither (in other words, he would challenge the premise that he "had to choose"). Those of us who think there are some wrongs that are wrong no matter how good the consequences are sometimes called deontologists.
Your question might meet with different responses depending on how "terrorism" is defined and if one were to argue about the permissibility of some very minor act of terrorism (subjecting only a few people to fear but without any intent on actually inflicting physical harm) in order to avoid some profoundly worst act of terrorism. But if we think about the recent attack in Paris, I myself think that there is no reason (probable or imaginary) that would justify such a massacre. Arguments might be difficult here. That is, I might have trouble convincing a self-confident consequentialist. But one objection to consequentialism that I believe to be forceful is that consequentialism seems to be on a slippery slope such that almost anything (massive rapes, murder, torture...)might be justified so long as those acts would produce greater consequences and there is no other action available that would produce greater consequences. That consequence seems to me to run against moral experience and the teaching of many, significant moral and religious traditions (that I deeply respect).