2015-11-02 19:32:07 +00:00
|
|
|
---
|
|
|
|
layout: "google"
|
|
|
|
page_title: "Google: google_compute_target_https_proxy"
|
|
|
|
sidebar_current: "docs-google-compute-target-https-proxy"
|
|
|
|
description: |-
|
|
|
|
Creates a Target HTTPS Proxy resource in GCE.
|
|
|
|
---
|
|
|
|
|
|
|
|
# google\_compute\_target\_https\_proxy
|
|
|
|
|
|
|
|
Creates a target HTTPS proxy resource in GCE. For more information see
|
|
|
|
[the official
|
|
|
|
documentation](https://cloud.google.com/compute/docs/load-balancing/http/target-proxies) and
|
|
|
|
[API](https://cloud.google.com/compute/docs/reference/latest/targetHttpsProxies).
|
|
|
|
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 10:17:54 +00:00
|
|
|
```hcl
|
2015-11-02 19:32:07 +00:00
|
|
|
resource "google_compute_target_https_proxy" "default" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "test-proxy"
|
|
|
|
description = "a description"
|
|
|
|
url_map = "${google_compute_url_map.default.self_link}"
|
|
|
|
ssl_certificates = ["${google_compute_ssl_certificate.default.self_link}"]
|
2015-11-02 19:32:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_ssl_certificate" "default" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "my-certificate"
|
|
|
|
description = "a description"
|
|
|
|
private_key = "${file("path/to/private.key")}"
|
|
|
|
certificate = "${file("path/to/certificate.crt")}"
|
2015-11-02 19:32:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_url_map" "default" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "url-map"
|
|
|
|
description = "a description"
|
2015-11-02 19:32:07 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
default_service = "${google_compute_backend_service.default.self_link}"
|
|
|
|
|
|
|
|
host_rule {
|
|
|
|
hosts = ["mysite.com"]
|
|
|
|
path_matcher = "allpaths"
|
|
|
|
}
|
2015-11-02 19:32:07 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
path_matcher {
|
|
|
|
name = "allpaths"
|
|
|
|
default_service = "${google_compute_backend_service.default.self_link}"
|
|
|
|
|
|
|
|
path_rule {
|
2017-02-18 22:48:50 +00:00
|
|
|
paths = ["/*"]
|
2016-04-10 21:34:15 +00:00
|
|
|
service = "${google_compute_backend_service.default.self_link}"
|
2015-11-02 19:32:07 +00:00
|
|
|
}
|
2016-04-10 21:34:15 +00:00
|
|
|
}
|
2015-11-02 19:32:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_backend_service" "default" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "default-backend"
|
|
|
|
port_name = "http"
|
|
|
|
protocol = "HTTP"
|
|
|
|
timeout_sec = 10
|
2015-11-02 19:32:07 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
health_checks = ["${google_compute_http_health_check.default.self_link}"]
|
2015-11-02 19:32:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_http_health_check" "default" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "test"
|
|
|
|
request_path = "/"
|
|
|
|
check_interval_sec = 1
|
|
|
|
timeout_sec = 1
|
2015-11-02 19:32:07 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
* `name` - (Required) A unique name for the resource, required by GCE. Changing
|
|
|
|
this forces a new resource to be created.
|
|
|
|
|
2018-01-31 00:07:43 +00:00
|
|
|
* `ssl_certificates` - (Required) The URLs or names of the SSL Certificate resources
|
|
|
|
that authenticate connections between users and load balancing.
|
2016-04-10 21:34:15 +00:00
|
|
|
|
|
|
|
* `url_map` - (Required) The URL of a URL Map resource that defines the mapping
|
|
|
|
from the URL to the BackendService.
|
|
|
|
|
|
|
|
- - -
|
|
|
|
|
|
|
|
* `description` - (Optional) A description of this resource. Changing this
|
|
|
|
forces a new resource to be created.
|
|
|
|
|
|
|
|
* `project` - (Optional) The project in which the resource belongs. If it
|
|
|
|
is not provided, the provider project is used.
|
2015-11-02 19:32:07 +00:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
In addition to the arguments listed above, the following computed attributes are
|
|
|
|
exported:
|
2015-11-02 19:32:07 +00:00
|
|
|
|
2017-09-25 14:23:46 +00:00
|
|
|
* `proxy_id` - A unique ID assigned by GCE.
|
2016-04-10 21:34:15 +00:00
|
|
|
|
|
|
|
* `self_link` - The URI of the created resource.
|
2017-11-09 18:16:57 +00:00
|
|
|
|
|
|
|
## Import
|
|
|
|
|
|
|
|
Target HTTPS Proxy can be imported using the `name`, e.g.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ terraform import compute_target_https_proxy.foobar foobar
|
|
|
|
```
|