The massive amount of data generated daily by various sensors equipped with connected autonomous vehicles (CAVs) can lead to a significant performance issue of data processing and transfer. Network Function Virtualization (NFV) is a promising approach to improving the performance of a CAV system. In an NFV framework, Virtual Network Function (VNF) instances can be placed in edge and cloud servers and connected together to enable a flexible CAV service with low latency. However, protecting a service function chain composed of several VNFs from a failure is challenging in an NFV-based CAV system (VCAV). We propose an integer linear programming (ILP) model and two approximation algorithms for resilient services to minimize the service disruption cost in a VCAV system when a failure occurs. The ILP model, referred to as TERO, allows us to obtain the optimal solution for traffic engineering, including the VNF placement and routing for resilient services with regard to dynamic routing. Our proposed algorithms based on heuristics (i.e., TERH) and reinforcement learning (i.e., TERA) provide an approximation solution for resilient services in a large-scale VCAV system. Evaluation results with real datasets and generated network topologies show that TERH and TERA can provide a solution close to the optimal result. It also suggests that TERA should be used in a highly dynamic VCAV system.