github.com/andresvia/terraform@v0.6.15-0.20160412045437-d51c75946785/website/source/docs/providers/google/r/compute_url_map.html.markdown (about)

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_compute_url_map"
     4  sidebar_current: "docs-google-compute-url-map"
     5  description: |-
     6    Manages a URL Map resource in GCE.
     7  ---
     8  
     9  # google\_compute\_url\_map
    10  
    11  Manages a URL Map resource within GCE. For more information see
    12  [the official documentation](https://cloud.google.com/compute/docs/load-balancing/http/url-map)
    13  and
    14  [API](https://cloud.google.com/compute/docs/reference/latest/urlMaps).
    15  
    16  
    17  ## Example Usage
    18  
    19  ```js
    20  resource "google_compute_url_map" "foobar" {
    21    name        = "urlmap"
    22    description = "a description"
    23  
    24    default_service = "${google_compute_backend_service.home.self_link}"
    25  
    26    host_rule {
    27      hosts        = ["mysite.com"]
    28      path_matcher = "allpaths"
    29    }
    30  
    31    path_matcher {
    32      name            = "allpaths"
    33      default_service = "${google_compute_backend_service.home.self_link}"
    34  
    35      path_rule {
    36        paths   = ["/home"]
    37        service = "${google_compute_backend_service.home.self_link}"
    38      }
    39  
    40      path_rule {
    41        paths   = ["/login"]
    42        service = "${google_compute_backend_service.login.self_link}"
    43      }
    44    }
    45  
    46    test {
    47      service = "${google_compute_backend_service.home.self_link}"
    48      host    = "hi.com"
    49      path    = "/home"
    50    }
    51  }
    52  
    53  resource "google_compute_backend_service" "login" {
    54    name        = "login-backend"
    55    port_name   = "http"
    56    protocol    = "HTTP"
    57    timeout_sec = 10
    58    region      = "us-central1"
    59  
    60    health_checks = ["${google_compute_http_health_check.default.self_link}"]
    61  }
    62  
    63  resource "google_compute_backend_service" "home" {
    64    name        = "home-backend"
    65    port_name   = "http"
    66    protocol    = "HTTP"
    67    timeout_sec = 10
    68    region      = "us-central1"
    69  
    70    health_checks = ["${google_compute_http_health_check.default.self_link}"]
    71  }
    72  
    73  resource "google_compute_http_health_check" "default" {
    74    name               = "test"
    75    request_path       = "/"
    76    check_interval_sec = 1
    77    timeout_sec        = 1
    78  }
    79  ```
    80  
    81  ## Argument Reference
    82  
    83  The following arguments are supported:
    84  
    85  * `default_service` - (Required) The URL of the backend service to use when none
    86      of the given rules match. See the documentation for formatting the service
    87      URL
    88      [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#defaultService)
    89  
    90  * `name` - (Required) A unique name for the resource, required by GCE.
    91      Changing this forces a new resource to be created.
    92  
    93  - - -
    94  
    95  * `description` - (Optional) A brief description of this resource.
    96  
    97  * `host_rule` - (Optional) A list of host rules. See below for configuration
    98      options.
    99  
   100  * `path_matcher` - (Optional) A list of paths to match. See below for
   101      configuration options.
   102  
   103  * `project` - (Optional) The project in which the resource belongs. If it
   104      is not provided, the provider project is used.
   105  
   106  * `test` - (Optional) The test to perform. See below for configuration options.
   107  
   108  The `host_rule` block supports: (This block can be defined multiple times).
   109  
   110  * `hosts` (Required) - A list of hosts to match against. See the documentation
   111      for formatting each host
   112      [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#hostRules.hosts)
   113  
   114  * `description` - (Optional) An optional description of the host rule.
   115  
   116  * `path_matcher` - (Required) The name of the `path_matcher` (defined below)
   117      to apply this host rule to.
   118  
   119  The `path_matcher` block supports: (This block can be defined multiple times)
   120  
   121  * `default_service` - (Required) The URL for the backend service to use if none
   122      of the given paths match. See the documentation for formatting the service
   123      URL [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService)
   124  
   125  * `name` - (Required) The name of the `path_matcher` resource. Used by the
   126      `host_rule` block above.
   127  
   128  * `description` - (Optional) An optional description of the host rule.
   129  
   130  The `path_matcher.path_rule` sub-block supports: (This block can be defined
   131  multiple times)
   132  
   133  * `paths` - (Required) The list of paths to match against. See the
   134      documentation for formatting these [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatchers.pathRules.paths)
   135  
   136  * `default_service` - (Required) The URL for the backend service to use if any
   137      of the given paths match. See the documentation for formatting the service
   138      URL [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService)
   139  
   140  The optional `test` block supports: (This block can be defined multiple times)
   141  
   142  * `service` - (Required) The service that should be matched by this test.
   143  
   144  * `host` - (Required) The host component of the URL being tested.
   145  
   146  * `path` - (Required) The path component of the URL being tested.
   147  
   148  * `description` - (Optional) An optional description of this test.
   149  
   150  ## Attributes Reference
   151  
   152  In addition to the arguments listed above, the following computed attributes are
   153  exported:
   154  
   155  * `fingerprint` - The unique fingerprint for this resource.
   156  
   157  * `id` - The GCE assigned ID of the resource.
   158  
   159  * `self_link` - The URI of the created resource.