return only the first two terms of custom post

Maybe this can help. First, get all the post’s terms; then, cycle through them with a foreach loop to retrieve and echo each one’s link. The last line of code will limit the cycle to the first two terms.

    $terms = wp_get_post_terms(); // If you're not in the loop, you should pass the post's ID as an argument.

    $i = 0;

    foreach ( $terms as $term ) {

        $name = $term->name;
        $href = get_term_link( $term->term_id ); 

        echo '<a href="' . $href . '">' . $name . '</a>';

        if ( ++$i == 2 ) break; // Limit to first 2 tags

    }