If you want to access the specific resources, you need to use L3 VPN.
If you want to access the entire resources, you need to use L2 VPN.
With a L2 VPN, site A and site B, look act and feel like they are on the common L2 network together. A router at site A can be an OSPF neighbor with a router at site B, as they appear directly connected.
With a L3 VPN, we don’t have a direct connection between sites at L2. With a L3 VPN, we peer with the SP edge, and by learning routes from the SP, we have L3 connectivity between sites A and B.
Purpose of both the way of VPN connectivity is same, to connect two different site. The only difference is the way we connect both the site together for intercommunication.
In both the VPN stlye we use Service provider network to traverse from one site to other.
L3 VPN: Here we make direct connectivity with edge device of service provider, and this we have to do at both the end. Next we have to share our local routes with Service provider, which eventually transmitted to the other end of your VPN (i.e. your other site). So here service provider knows about our local routes. This way both the site have each others routes, making it L3 connectivity (As we have L3 routes)
L2 VPN: Connectivity in L2 VPN looks like both the site are on same L2 network together. To achive this Service provider make a predefined virtual connection in their network, known as pseudowire connection, between your two sites. So here we don’t have to share our local routes with service provider, so service provider stays transparent with about our internal routes. In L2 VPN communication happens in the same way we do at our single site local network.