Expand description
Represents a RegionTargetHttpProxy resource, which is used by one or more forwarding rules to route incoming HTTP requests to a URL map.
To get more information about RegionTargetHttpProxy, see:
- API documentation
- How-to Guides
§Example Usage
§Region Target Http Proxy Basic
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let default = region_target_http_proxy::create(
"default",
RegionTargetHttpProxyArgs::builder()
.name("test-proxy")
.region("us-central1")
.url_map("${defaultRegionUrlMap.id}")
.build_struct(),
);
let defaultRegionBackendService = region_backend_service::create(
"defaultRegionBackendService",
RegionBackendServiceArgs::builder()
.health_checks("${defaultRegionHealthCheck.id}")
.load_balancing_scheme("INTERNAL_MANAGED")
.name("backend-service")
.protocol("HTTP")
.region("us-central1")
.timeout_sec(10)
.build_struct(),
);
let defaultRegionHealthCheck = region_health_check::create(
"defaultRegionHealthCheck",
RegionHealthCheckArgs::builder()
.http_health_check(
RegionHealthCheckHttpHealthCheck::builder().port(80).build_struct(),
)
.name("http-health-check")
.region("us-central1")
.build_struct(),
);
let defaultRegionUrlMap = region_url_map::create(
"defaultRegionUrlMap",
RegionUrlMapArgs::builder()
.default_service("${defaultRegionBackendService.id}")
.host_rules(
vec![
RegionUrlMapHostRule::builder().hosts(vec!["mysite.com",])
.pathMatcher("allpaths").build_struct(),
],
)
.name("url-map")
.path_matchers(
vec![
RegionUrlMapPathMatcher::builder()
.defaultService("${defaultRegionBackendService.id}").name("allpaths")
.pathRules(vec![RegionUrlMapPathMatcherPathRule::builder()
.paths(vec!["/*",]).service("${defaultRegionBackendService.id}")
.build_struct(),]).build_struct(),
],
)
.region("us-central1")
.build_struct(),
);
}
§Region Target Http Proxy Http Keep Alive Timeout
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let default = region_target_http_proxy::create(
"default",
RegionTargetHttpProxyArgs::builder()
.http_keep_alive_timeout_sec(600)
.name("test-http-keep-alive-timeout-proxy")
.region("us-central1")
.url_map("${defaultRegionUrlMap.id}")
.build_struct(),
);
let defaultRegionBackendService = region_backend_service::create(
"defaultRegionBackendService",
RegionBackendServiceArgs::builder()
.health_checks("${defaultRegionHealthCheck.id}")
.load_balancing_scheme("INTERNAL_MANAGED")
.name("backend-service")
.port_name("http")
.protocol("HTTP")
.region("us-central1")
.timeout_sec(10)
.build_struct(),
);
let defaultRegionHealthCheck = region_health_check::create(
"defaultRegionHealthCheck",
RegionHealthCheckArgs::builder()
.http_health_check(
RegionHealthCheckHttpHealthCheck::builder().port(80).build_struct(),
)
.name("http-health-check")
.region("us-central1")
.build_struct(),
);
let defaultRegionUrlMap = region_url_map::create(
"defaultRegionUrlMap",
RegionUrlMapArgs::builder()
.default_service("${defaultRegionBackendService.id}")
.host_rules(
vec![
RegionUrlMapHostRule::builder().hosts(vec!["mysite.com",])
.pathMatcher("allpaths").build_struct(),
],
)
.name("url-map")
.path_matchers(
vec![
RegionUrlMapPathMatcher::builder()
.defaultService("${defaultRegionBackendService.id}").name("allpaths")
.pathRules(vec![RegionUrlMapPathMatcherPathRule::builder()
.paths(vec!["/*",]).service("${defaultRegionBackendService.id}")
.build_struct(),]).build_struct(),
],
)
.region("us-central1")
.build_struct(),
);
}
§Region Target Http Proxy Https Redirect
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let default = region_target_http_proxy::create(
"default",
RegionTargetHttpProxyArgs::builder()
.name("test-https-redirect-proxy")
.region("us-central1")
.url_map("${defaultRegionUrlMap.id}")
.build_struct(),
);
let defaultRegionUrlMap = region_url_map::create(
"defaultRegionUrlMap",
RegionUrlMapArgs::builder()
.default_url_redirect(
RegionUrlMapDefaultUrlRedirect::builder()
.httpsRedirect(true)
.stripQuery(false)
.build_struct(),
)
.name("url-map")
.region("us-central1")
.build_struct(),
);
}
§Import
RegionTargetHttpProxy can be imported using any of these accepted formats:
-
projects/{{project}}/regions/{{region}}/targetHttpProxies/{{name}}
-
{{project}}/{{region}}/{{name}}
-
{{region}}/{{name}}
-
{{name}}
When using the pulumi import
command, RegionTargetHttpProxy can be imported using one of the formats above. For example:
$ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy default projects/{{project}}/regions/{{region}}/targetHttpProxies/{{name}}
$ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy default {{region}}/{{name}}
$ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy 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