blob: 23fa6563772346ec340829e65f69212261f437fb [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Compute Engine"
description: |-
Represents a Target gRPC Proxy resource.
---
# google\_compute\_target\_grpc\_proxy
Represents a Target gRPC Proxy resource. A target gRPC proxy is a component
of load balancers intended for load balancing gRPC traffic. Global forwarding
rules reference a target gRPC proxy. The Target gRPC Proxy references
a URL map which specifies how traffic routes to gRPC backend services.
To get more information about TargetGrpcProxy, see:
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/targetGrpcProxies)
* How-to Guides
* [Using Target gRPC Proxies](https://cloud.google.com/traffic-director/docs/proxyless-overview)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=target_grpc_proxy_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Target Grpc Proxy Basic
```hcl
resource "google_compute_target_grpc_proxy" "default" {
name = "proxy"
url_map = google_compute_url_map.urlmap.id
validate_for_proxyless = true
}
resource "google_compute_url_map" "urlmap" {
name = "urlmap"
description = "a description"
default_service = google_compute_backend_service.home.id
host_rule {
hosts = ["mysite.com"]
path_matcher = "allpaths"
}
path_matcher {
name = "allpaths"
default_service = google_compute_backend_service.home.id
route_rules {
priority = 1
header_action {
request_headers_to_remove = ["RemoveMe2"]
request_headers_to_add {
header_name = "AddSomethingElse"
header_value = "MyOtherValue"
replace = true
}
response_headers_to_remove = ["RemoveMe3"]
response_headers_to_add {
header_name = "AddMe"
header_value = "MyValue"
replace = false
}
}
match_rules {
full_path_match = "a full path"
header_matches {
header_name = "someheader"
exact_match = "match this exactly"
invert_match = true
}
ignore_case = true
metadata_filters {
filter_match_criteria = "MATCH_ANY"
filter_labels {
name = "PLANET"
value = "MARS"
}
}
query_parameter_matches {
name = "a query parameter"
present_match = true
}
}
url_redirect {
host_redirect = "A host"
https_redirect = false
path_redirect = "some/path"
redirect_response_code = "TEMPORARY_REDIRECT"
strip_query = true
}
}
}
test {
service = google_compute_backend_service.home.id
host = "hi.com"
path = "/home"
}
}
resource "google_compute_backend_service" "home" {
name = "backend"
port_name = "grpc"
protocol = "GRPC"
timeout_sec = 10
health_checks = [google_compute_health_check.default.id]
load_balancing_scheme = "INTERNAL_SELF_MANAGED"
}
resource "google_compute_health_check" "default" {
name = "healthcheck"
timeout_sec = 1
check_interval_sec = 1
grpc_health_check {
port_name = "health-check-port"
port_specification = "USE_NAMED_PORT"
grpc_service_name = "testservice"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` -
(Required)
Name of the resource. Provided by the client when the resource
is created. The name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long
and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which
means the first character must be a lowercase letter, and all
following characters must be a dash, lowercase letter, or digit,
except the last character, which cannot be a dash.
- - -
* `description` -
(Optional)
An optional description of this resource.
* `url_map` -
(Optional)
URL to the UrlMap resource that defines the mapping from URL to
the BackendService. The protocol field in the BackendService
must be set to GRPC.
* `validate_for_proxyless` -
(Optional)
If true, indicates that the BackendServices referenced by
the urlMap may be accessed by gRPC applications without using
a sidecar proxy. This will enable configuration checks on urlMap
and its referenced BackendServices to not allow unsupported features.
A gRPC application must use "xds:///" scheme in the target URI
of the service it is connecting to. If false, indicates that the
BackendServices referenced by the urlMap will be accessed by gRPC
applications via a sidecar proxy. In this case, a gRPC application
must not use "xds:///" scheme in the target URI of the service
it is connecting to
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `projects/{{project}}/global/targetGrpcProxies/{{name}}`
* `creation_timestamp` -
Creation timestamp in RFC3339 text format.
* `self_link_with_id` -
Server-defined URL with id for the resource.
* `fingerprint` -
Fingerprint of this resource. A hash of the contents stored in
this object. This field is used in optimistic locking. This field
will be ignored when inserting a TargetGrpcProxy. An up-to-date
fingerprint must be provided in order to patch/update the
TargetGrpcProxy; otherwise, the request will fail with error
412 conditionNotMet. To see the latest fingerprint, make a get()
request to retrieve the TargetGrpcProxy. A base64-encoded string.
* `self_link` - The URI of the created resource.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
TargetGrpcProxy can be imported using any of these accepted formats:
* `projects/{{project}}/global/targetGrpcProxies/{{name}}`
* `{{project}}/{{name}}`
* `{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import TargetGrpcProxy using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/global/targetGrpcProxies/{{name}}"
to = google_compute_target_grpc_proxy.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), TargetGrpcProxy can be imported using one of the formats above. For example:
```
$ terraform import google_compute_target_grpc_proxy.default projects/{{project}}/global/targetGrpcProxies/{{name}}
$ terraform import google_compute_target_grpc_proxy.default {{project}}/{{name}}
$ terraform import google_compute_target_grpc_proxy.default {{name}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).