Expand description
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
- How-to Guides
§Example Usage
§Target Grpc Proxy Basic
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let default = target_grpc_proxy::create(
"default",
TargetGrpcProxyArgs::builder()
.name("proxy")
.url_map("${urlmap.id}")
.validate_for_proxyless(true)
.build_struct(),
);
let defaultHealthCheck = health_check::create(
"defaultHealthCheck",
HealthCheckArgs::builder()
.check_interval_sec(1)
.grpc_health_check(
HealthCheckGrpcHealthCheck::builder()
.grpcServiceName("testservice")
.portName("health-check-port")
.portSpecification("USE_NAMED_PORT")
.build_struct(),
)
.name("healthcheck")
.timeout_sec(1)
.build_struct(),
);
let home = backend_service::create(
"home",
BackendServiceArgs::builder()
.health_checks("${defaultHealthCheck.id}")
.load_balancing_scheme("INTERNAL_SELF_MANAGED")
.name("backend")
.port_name("grpc")
.protocol("GRPC")
.timeout_sec(10)
.build_struct(),
);
let urlmap = url_map::create(
"urlmap",
UrlMapArgs::builder()
.default_service("${home.id}")
.description("a description")
.host_rules(
vec![
UrlMapHostRule::builder().hosts(vec!["mysite.com",])
.pathMatcher("allpaths").build_struct(),
],
)
.name("urlmap")
.path_matchers(
vec![
UrlMapPathMatcher::builder().defaultService("${home.id}")
.name("allpaths")
.routeRules(vec![UrlMapPathMatcherRouteRule::builder()
.headerAction(UrlMapPathMatcherRouteRuleHeaderAction::builder()
.requestHeadersToAdds(vec![UrlMapPathMatcherRouteRuleHeaderActionRequestHeadersToAdd::builder()
.headerName("AddSomethingElse").headerValue("MyOtherValue")
.replace(true).build_struct(),])
.requestHeadersToRemoves(vec!["RemoveMe2",])
.responseHeadersToAdds(vec![UrlMapPathMatcherRouteRuleHeaderActionResponseHeadersToAdd::builder()
.headerName("AddMe").headerValue("MyValue").replace(false)
.build_struct(),]).responseHeadersToRemoves(vec!["RemoveMe3",])
.build_struct())
.matchRules(vec![UrlMapPathMatcherRouteRuleMatchRule::builder()
.fullPathMatch("a full path")
.headerMatches(vec![UrlMapPathMatcherRouteRuleMatchRuleHeaderMatch::builder()
.exactMatch("match this exactly").headerName("someheader")
.invertMatch(true).build_struct(),]).ignoreCase(true)
.metadataFilters(vec![UrlMapPathMatcherRouteRuleMatchRuleMetadataFilter::builder()
.filterLabels(vec![UrlMapPathMatcherRouteRuleMatchRuleMetadataFilterFilterLabel::builder()
.name("PLANET").value("MARS").build_struct(),])
.filterMatchCriteria("MATCH_ANY").build_struct(),])
.queryParameterMatches(vec![UrlMapPathMatcherRouteRuleMatchRuleQueryParameterMatch::builder()
.name("a query parameter").presentMatch(true).build_struct(),])
.build_struct(),]).priority(1)
.urlRedirect(UrlMapPathMatcherRouteRuleUrlRedirect::builder()
.hostRedirect("A host").httpsRedirect(false)
.pathRedirect("some/path").redirectResponseCode("TEMPORARY_REDIRECT")
.stripQuery(true).build_struct()).build_struct(),]).build_struct(),
],
)
.tests(
vec![
UrlMapTest::builder().host("hi.com").path("/home")
.service("${home.id}").build_struct(),
],
)
.build_struct(),
);
}
§Import
TargetGrpcProxy can be imported using any of these accepted formats:
-
projects/{{project}}/global/targetGrpcProxies/{{name}}
-
{{project}}/{{name}}
-
{{name}}
When using the pulumi import
command, TargetGrpcProxy can be imported using one of the formats above. For example:
$ pulumi import gcp:compute/targetGrpcProxy:TargetGrpcProxy default projects/{{project}}/global/targetGrpcProxies/{{name}}
$ pulumi import gcp:compute/targetGrpcProxy:TargetGrpcProxy default {{project}}/{{name}}
$ pulumi import gcp:compute/targetGrpcProxy:TargetGrpcProxy default {{name}}
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments