pulumi_wasm_providers_gcp_mini::compute

Module target_http_proxy

source
Expand description

Represents a TargetHttpProxy resource, which is used by one or more global forwarding rule to route incoming HTTP requests to a URL map.

To get more information about TargetHttpProxy, see:

§Example Usage

§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 = target_http_proxy::create(
        "default",
        TargetHttpProxyArgs::builder()
            .name("test-proxy")
            .url_map("${defaultURLMap.id}")
            .build_struct(),
    );
    let defaultBackendService = backend_service::create(
        "defaultBackendService",
        BackendServiceArgs::builder()
            .health_checks("${defaultHttpHealthCheck.id}")
            .name("backend-service")
            .port_name("http")
            .protocol("HTTP")
            .timeout_sec(10)
            .build_struct(),
    );
    let defaultHttpHealthCheck = http_health_check::create(
        "defaultHttpHealthCheck",
        HttpHealthCheckArgs::builder()
            .check_interval_sec(1)
            .name("http-health-check")
            .request_path("/")
            .timeout_sec(1)
            .build_struct(),
    );
    let defaultURLMap = url_map::create(
        "defaultURLMap",
        UrlMapArgs::builder()
            .default_service("${defaultBackendService.id}")
            .host_rules(
                vec![
                    UrlMapHostRule::builder().hosts(vec!["mysite.com",])
                    .pathMatcher("allpaths").build_struct(),
                ],
            )
            .name("url-map")
            .path_matchers(
                vec![
                    UrlMapPathMatcher::builder()
                    .defaultService("${defaultBackendService.id}").name("allpaths")
                    .pathRules(vec![UrlMapPathMatcherPathRule::builder()
                    .paths(vec!["/*",]).service("${defaultBackendService.id}")
                    .build_struct(),]).build_struct(),
                ],
            )
            .build_struct(),
    );
}

§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 = target_http_proxy::create(
        "default",
        TargetHttpProxyArgs::builder()
            .http_keep_alive_timeout_sec(610)
            .name("test-http-keep-alive-timeout-proxy")
            .url_map("${defaultURLMap.id}")
            .build_struct(),
    );
    let defaultBackendService = backend_service::create(
        "defaultBackendService",
        BackendServiceArgs::builder()
            .health_checks("${defaultHttpHealthCheck.id}")
            .load_balancing_scheme("EXTERNAL_MANAGED")
            .name("backend-service")
            .port_name("http")
            .protocol("HTTP")
            .timeout_sec(10)
            .build_struct(),
    );
    let defaultHttpHealthCheck = http_health_check::create(
        "defaultHttpHealthCheck",
        HttpHealthCheckArgs::builder()
            .check_interval_sec(1)
            .name("http-health-check")
            .request_path("/")
            .timeout_sec(1)
            .build_struct(),
    );
    let defaultURLMap = url_map::create(
        "defaultURLMap",
        UrlMapArgs::builder()
            .default_service("${defaultBackendService.id}")
            .host_rules(
                vec![
                    UrlMapHostRule::builder().hosts(vec!["mysite.com",])
                    .pathMatcher("allpaths").build_struct(),
                ],
            )
            .name("url-map")
            .path_matchers(
                vec![
                    UrlMapPathMatcher::builder()
                    .defaultService("${defaultBackendService.id}").name("allpaths")
                    .pathRules(vec![UrlMapPathMatcherPathRule::builder()
                    .paths(vec!["/*",]).service("${defaultBackendService.id}")
                    .build_struct(),]).build_struct(),
                ],
            )
            .build_struct(),
    );
}

§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 = target_http_proxy::create(
        "default",
        TargetHttpProxyArgs::builder()
            .name("test-https-redirect-proxy")
            .url_map("${defaultURLMap.id}")
            .build_struct(),
    );
    let defaultURLMap = url_map::create(
        "defaultURLMap",
        UrlMapArgs::builder()
            .default_url_redirect(
                UrlMapDefaultUrlRedirect::builder()
                    .httpsRedirect(true)
                    .stripQuery(false)
                    .build_struct(),
            )
            .name("url-map")
            .build_struct(),
    );
}

§Import

TargetHttpProxy can be imported using any of these accepted formats:

  • projects/{{project}}/global/targetHttpProxies/{{name}}

  • {{project}}/{{name}}

  • {{name}}

When using the pulumi import command, TargetHttpProxy can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/targetHttpProxy:TargetHttpProxy default projects/{{project}}/global/targetHttpProxies/{{name}}
$ pulumi import gcp:compute/targetHttpProxy:TargetHttpProxy default {{project}}/{{name}}
$ pulumi import gcp:compute/targetHttpProxy:TargetHttpProxy default {{name}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments