title: GCP url map creating path rules for different backend services
body: <p>Below is my terraform script. I have set up the necessary forwarding rules and target http proxies. Also the backend services exist. I am able to access all paths under <code>/images/*</code>, however, I can’t access the paths under <code>/videos/*</code>. From the script, the dafault backend service is <code>backend-lb-prod</code> which is the backend service where the path <code>/images/*</code> exists. I switched the default backend service to <code>backend-lb</code>, I could now access <code>/videos/*</code> but not <code>/images/*</code>. </p>
  
  <pre><code>resource "google_compute_url_map" "url-map-be" {
    name            = "${var.platform_name}-url-map-be-prod"
    default_service = "${google_compute_backend_service.backend-lb-prod.self_link}"
  
    host_rule {
      hosts        = ["${var.backend_address_name}"]
      path_matcher = "allpaths"
    }
  
    path_matcher {
      name            = "allpaths"
      default_service = "${google_compute_backend_service.backend-lb-prod.self_link}"
  
      path_rule {
        paths   = [“/images"]
        service = "${google_compute_backend_service.backend-lb-prod.self_link}"
      }  
  
      path_rule {
        paths   = [“/images/*"]
        service = "${google_compute_backend_service.backend-lb-prod.self_link}"
      } 
  
      path_rule {
        paths   = ["/videos"]
        service = "${google_compute_backend_service.backend-lb.self_link}"
      }  
  
      path_rule {
        paths   = ["/videos/*"]
        service = "${google_compute_backend_service.backend-lb.self_link}"
      }
  
    }
  }
  </code></pre>
  
  <p>When I run the tests for the url map on the google console, this is the error I get</p>
  
  <pre><code>Invalid value for field 'resource': ''. Test failure: Expect URL ‘*.*.*.*/videos/go' 
  to map to service ‘***93-BACKEND_SERVICE-**-backend-lb', but actually mapped to 
  '***93-BACKEND_SERVICE-**-backend-lb-prod’.
  </code></pre>
  
  <p>This is how <code>google_compute_url_map</code> in the terraform <a href="https://www.terraform.io/docs/providers/google/r/compute_url_map.html" rel="nofollow noreferrer">documentation</a> is illustrated. What am I missing in this case.</p>
  
  <p><strong>update</strong></p>
  
  <p>I have included the <code>/videos</code> and <code>/images</code> paths and the error above is gone. However, from the logs of the application, the traffic is still sent through the default backend service.</p>