I know how $\int{\frac{dx}{x^2-a^2}} = \frac{1}{2a} \log {|\frac{x-a}{x+a}|} + C$
Using the above derivation, I derived
$$\int{\frac{dx}{a^2-x^2}} = -\int{\frac{dx}{x^2-a^2}} = \frac{1}{2a} \log {|\frac{x+a}{x-a}|} + C$$
But my textbook derived differently and got
$$\int{\frac{dx}{a^2-x^2}} = -\int{\frac{dx}{x^2-a^2}} = \frac{1}{2a} \log {|\frac{a+x}{a-x}|} + C$$
How they both are equivalent? Or is my derivation wrong?


They're both equivalent. The absolute value would make it so that the denominator is the same for both answers. i.e. since $x-a = -(a-x)$, $|x-a| = |a-x|$. Absolute value would remove the negative sign.