1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. TargetHttpProxy
Google Cloud Classic v7.27.0 published on Thursday, Jun 13, 2024 by Pulumi

gcp.compute.TargetHttpProxy

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.27.0 published on Thursday, Jun 13, 2024 by Pulumi

    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

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
        name: "http-health-check",
        requestPath: "/",
        checkIntervalSec: 1,
        timeoutSec: 1,
    });
    const defaultBackendService = new gcp.compute.BackendService("default", {
        name: "backend-service",
        portName: "http",
        protocol: "HTTP",
        timeoutSec: 10,
        healthChecks: defaultHttpHealthCheck.id,
    });
    const defaultURLMap = new gcp.compute.URLMap("default", {
        name: "url-map",
        defaultService: defaultBackendService.id,
        hostRules: [{
            hosts: ["mysite.com"],
            pathMatcher: "allpaths",
        }],
        pathMatchers: [{
            name: "allpaths",
            defaultService: defaultBackendService.id,
            pathRules: [{
                paths: ["/*"],
                service: defaultBackendService.id,
            }],
        }],
    });
    const _default = new gcp.compute.TargetHttpProxy("default", {
        name: "test-proxy",
        urlMap: defaultURLMap.id,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default_http_health_check = gcp.compute.HttpHealthCheck("default",
        name="http-health-check",
        request_path="/",
        check_interval_sec=1,
        timeout_sec=1)
    default_backend_service = gcp.compute.BackendService("default",
        name="backend-service",
        port_name="http",
        protocol="HTTP",
        timeout_sec=10,
        health_checks=default_http_health_check.id)
    default_url_map = gcp.compute.URLMap("default",
        name="url-map",
        default_service=default_backend_service.id,
        host_rules=[gcp.compute.URLMapHostRuleArgs(
            hosts=["mysite.com"],
            path_matcher="allpaths",
        )],
        path_matchers=[gcp.compute.URLMapPathMatcherArgs(
            name="allpaths",
            default_service=default_backend_service.id,
            path_rules=[gcp.compute.URLMapPathMatcherPathRuleArgs(
                paths=["/*"],
                service=default_backend_service.id,
            )],
        )])
    default = gcp.compute.TargetHttpProxy("default",
        name="test-proxy",
        url_map=default_url_map.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		defaultHttpHealthCheck, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
    			Name:             pulumi.String("http-health-check"),
    			RequestPath:      pulumi.String("/"),
    			CheckIntervalSec: pulumi.Int(1),
    			TimeoutSec:       pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		defaultBackendService, err := compute.NewBackendService(ctx, "default", &compute.BackendServiceArgs{
    			Name:         pulumi.String("backend-service"),
    			PortName:     pulumi.String("http"),
    			Protocol:     pulumi.String("HTTP"),
    			TimeoutSec:   pulumi.Int(10),
    			HealthChecks: defaultHttpHealthCheck.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		defaultURLMap, err := compute.NewURLMap(ctx, "default", &compute.URLMapArgs{
    			Name:           pulumi.String("url-map"),
    			DefaultService: defaultBackendService.ID(),
    			HostRules: compute.URLMapHostRuleArray{
    				&compute.URLMapHostRuleArgs{
    					Hosts: pulumi.StringArray{
    						pulumi.String("mysite.com"),
    					},
    					PathMatcher: pulumi.String("allpaths"),
    				},
    			},
    			PathMatchers: compute.URLMapPathMatcherArray{
    				&compute.URLMapPathMatcherArgs{
    					Name:           pulumi.String("allpaths"),
    					DefaultService: defaultBackendService.ID(),
    					PathRules: compute.URLMapPathMatcherPathRuleArray{
    						&compute.URLMapPathMatcherPathRuleArgs{
    							Paths: pulumi.StringArray{
    								pulumi.String("/*"),
    							},
    							Service: defaultBackendService.ID(),
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewTargetHttpProxy(ctx, "default", &compute.TargetHttpProxyArgs{
    			Name:   pulumi.String("test-proxy"),
    			UrlMap: defaultURLMap.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var defaultHttpHealthCheck = new Gcp.Compute.HttpHealthCheck("default", new()
        {
            Name = "http-health-check",
            RequestPath = "/",
            CheckIntervalSec = 1,
            TimeoutSec = 1,
        });
    
        var defaultBackendService = new Gcp.Compute.BackendService("default", new()
        {
            Name = "backend-service",
            PortName = "http",
            Protocol = "HTTP",
            TimeoutSec = 10,
            HealthChecks = defaultHttpHealthCheck.Id,
        });
    
        var defaultURLMap = new Gcp.Compute.URLMap("default", new()
        {
            Name = "url-map",
            DefaultService = defaultBackendService.Id,
            HostRules = new[]
            {
                new Gcp.Compute.Inputs.URLMapHostRuleArgs
                {
                    Hosts = new[]
                    {
                        "mysite.com",
                    },
                    PathMatcher = "allpaths",
                },
            },
            PathMatchers = new[]
            {
                new Gcp.Compute.Inputs.URLMapPathMatcherArgs
                {
                    Name = "allpaths",
                    DefaultService = defaultBackendService.Id,
                    PathRules = new[]
                    {
                        new Gcp.Compute.Inputs.URLMapPathMatcherPathRuleArgs
                        {
                            Paths = new[]
                            {
                                "/*",
                            },
                            Service = defaultBackendService.Id,
                        },
                    },
                },
            },
        });
    
        var @default = new Gcp.Compute.TargetHttpProxy("default", new()
        {
            Name = "test-proxy",
            UrlMap = defaultURLMap.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.HttpHealthCheck;
    import com.pulumi.gcp.compute.HttpHealthCheckArgs;
    import com.pulumi.gcp.compute.BackendService;
    import com.pulumi.gcp.compute.BackendServiceArgs;
    import com.pulumi.gcp.compute.URLMap;
    import com.pulumi.gcp.compute.URLMapArgs;
    import com.pulumi.gcp.compute.inputs.URLMapHostRuleArgs;
    import com.pulumi.gcp.compute.inputs.URLMapPathMatcherArgs;
    import com.pulumi.gcp.compute.TargetHttpProxy;
    import com.pulumi.gcp.compute.TargetHttpProxyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder()
                .name("http-health-check")
                .requestPath("/")
                .checkIntervalSec(1)
                .timeoutSec(1)
                .build());
    
            var defaultBackendService = new BackendService("defaultBackendService", BackendServiceArgs.builder()
                .name("backend-service")
                .portName("http")
                .protocol("HTTP")
                .timeoutSec(10)
                .healthChecks(defaultHttpHealthCheck.id())
                .build());
    
            var defaultURLMap = new URLMap("defaultURLMap", URLMapArgs.builder()
                .name("url-map")
                .defaultService(defaultBackendService.id())
                .hostRules(URLMapHostRuleArgs.builder()
                    .hosts("mysite.com")
                    .pathMatcher("allpaths")
                    .build())
                .pathMatchers(URLMapPathMatcherArgs.builder()
                    .name("allpaths")
                    .defaultService(defaultBackendService.id())
                    .pathRules(URLMapPathMatcherPathRuleArgs.builder()
                        .paths("/*")
                        .service(defaultBackendService.id())
                        .build())
                    .build())
                .build());
    
            var default_ = new TargetHttpProxy("default", TargetHttpProxyArgs.builder()
                .name("test-proxy")
                .urlMap(defaultURLMap.id())
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:TargetHttpProxy
        properties:
          name: test-proxy
          urlMap: ${defaultURLMap.id}
      defaultURLMap:
        type: gcp:compute:URLMap
        name: default
        properties:
          name: url-map
          defaultService: ${defaultBackendService.id}
          hostRules:
            - hosts:
                - mysite.com
              pathMatcher: allpaths
          pathMatchers:
            - name: allpaths
              defaultService: ${defaultBackendService.id}
              pathRules:
                - paths:
                    - /*
                  service: ${defaultBackendService.id}
      defaultBackendService:
        type: gcp:compute:BackendService
        name: default
        properties:
          name: backend-service
          portName: http
          protocol: HTTP
          timeoutSec: 10
          healthChecks: ${defaultHttpHealthCheck.id}
      defaultHttpHealthCheck:
        type: gcp:compute:HttpHealthCheck
        name: default
        properties:
          name: http-health-check
          requestPath: /
          checkIntervalSec: 1
          timeoutSec: 1
    

    Target Http Proxy Http Keep Alive Timeout

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
        name: "http-health-check",
        requestPath: "/",
        checkIntervalSec: 1,
        timeoutSec: 1,
    });
    const defaultBackendService = new gcp.compute.BackendService("default", {
        name: "backend-service",
        portName: "http",
        protocol: "HTTP",
        timeoutSec: 10,
        loadBalancingScheme: "EXTERNAL_MANAGED",
        healthChecks: defaultHttpHealthCheck.id,
    });
    const defaultURLMap = new gcp.compute.URLMap("default", {
        name: "url-map",
        defaultService: defaultBackendService.id,
        hostRules: [{
            hosts: ["mysite.com"],
            pathMatcher: "allpaths",
        }],
        pathMatchers: [{
            name: "allpaths",
            defaultService: defaultBackendService.id,
            pathRules: [{
                paths: ["/*"],
                service: defaultBackendService.id,
            }],
        }],
    });
    const _default = new gcp.compute.TargetHttpProxy("default", {
        name: "test-http-keep-alive-timeout-proxy",
        httpKeepAliveTimeoutSec: 610,
        urlMap: defaultURLMap.id,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default_http_health_check = gcp.compute.HttpHealthCheck("default",
        name="http-health-check",
        request_path="/",
        check_interval_sec=1,
        timeout_sec=1)
    default_backend_service = gcp.compute.BackendService("default",
        name="backend-service",
        port_name="http",
        protocol="HTTP",
        timeout_sec=10,
        load_balancing_scheme="EXTERNAL_MANAGED",
        health_checks=default_http_health_check.id)
    default_url_map = gcp.compute.URLMap("default",
        name="url-map",
        default_service=default_backend_service.id,
        host_rules=[gcp.compute.URLMapHostRuleArgs(
            hosts=["mysite.com"],
            path_matcher="allpaths",
        )],
        path_matchers=[gcp.compute.URLMapPathMatcherArgs(
            name="allpaths",
            default_service=default_backend_service.id,
            path_rules=[gcp.compute.URLMapPathMatcherPathRuleArgs(
                paths=["/*"],
                service=default_backend_service.id,
            )],
        )])
    default = gcp.compute.TargetHttpProxy("default",
        name="test-http-keep-alive-timeout-proxy",
        http_keep_alive_timeout_sec=610,
        url_map=default_url_map.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		defaultHttpHealthCheck, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
    			Name:             pulumi.String("http-health-check"),
    			RequestPath:      pulumi.String("/"),
    			CheckIntervalSec: pulumi.Int(1),
    			TimeoutSec:       pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		defaultBackendService, err := compute.NewBackendService(ctx, "default", &compute.BackendServiceArgs{
    			Name:                pulumi.String("backend-service"),
    			PortName:            pulumi.String("http"),
    			Protocol:            pulumi.String("HTTP"),
    			TimeoutSec:          pulumi.Int(10),
    			LoadBalancingScheme: pulumi.String("EXTERNAL_MANAGED"),
    			HealthChecks:        defaultHttpHealthCheck.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		defaultURLMap, err := compute.NewURLMap(ctx, "default", &compute.URLMapArgs{
    			Name:           pulumi.String("url-map"),
    			DefaultService: defaultBackendService.ID(),
    			HostRules: compute.URLMapHostRuleArray{
    				&compute.URLMapHostRuleArgs{
    					Hosts: pulumi.StringArray{
    						pulumi.String("mysite.com"),
    					},
    					PathMatcher: pulumi.String("allpaths"),
    				},
    			},
    			PathMatchers: compute.URLMapPathMatcherArray{
    				&compute.URLMapPathMatcherArgs{
    					Name:           pulumi.String("allpaths"),
    					DefaultService: defaultBackendService.ID(),
    					PathRules: compute.URLMapPathMatcherPathRuleArray{
    						&compute.URLMapPathMatcherPathRuleArgs{
    							Paths: pulumi.StringArray{
    								pulumi.String("/*"),
    							},
    							Service: defaultBackendService.ID(),
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewTargetHttpProxy(ctx, "default", &compute.TargetHttpProxyArgs{
    			Name:                    pulumi.String("test-http-keep-alive-timeout-proxy"),
    			HttpKeepAliveTimeoutSec: pulumi.Int(610),
    			UrlMap:                  defaultURLMap.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var defaultHttpHealthCheck = new Gcp.Compute.HttpHealthCheck("default", new()
        {
            Name = "http-health-check",
            RequestPath = "/",
            CheckIntervalSec = 1,
            TimeoutSec = 1,
        });
    
        var defaultBackendService = new Gcp.Compute.BackendService("default", new()
        {
            Name = "backend-service",
            PortName = "http",
            Protocol = "HTTP",
            TimeoutSec = 10,
            LoadBalancingScheme = "EXTERNAL_MANAGED",
            HealthChecks = defaultHttpHealthCheck.Id,
        });
    
        var defaultURLMap = new Gcp.Compute.URLMap("default", new()
        {
            Name = "url-map",
            DefaultService = defaultBackendService.Id,
            HostRules = new[]
            {
                new Gcp.Compute.Inputs.URLMapHostRuleArgs
                {
                    Hosts = new[]
                    {
                        "mysite.com",
                    },
                    PathMatcher = "allpaths",
                },
            },
            PathMatchers = new[]
            {
                new Gcp.Compute.Inputs.URLMapPathMatcherArgs
                {
                    Name = "allpaths",
                    DefaultService = defaultBackendService.Id,
                    PathRules = new[]
                    {
                        new Gcp.Compute.Inputs.URLMapPathMatcherPathRuleArgs
                        {
                            Paths = new[]
                            {
                                "/*",
                            },
                            Service = defaultBackendService.Id,
                        },
                    },
                },
            },
        });
    
        var @default = new Gcp.Compute.TargetHttpProxy("default", new()
        {
            Name = "test-http-keep-alive-timeout-proxy",
            HttpKeepAliveTimeoutSec = 610,
            UrlMap = defaultURLMap.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.HttpHealthCheck;
    import com.pulumi.gcp.compute.HttpHealthCheckArgs;
    import com.pulumi.gcp.compute.BackendService;
    import com.pulumi.gcp.compute.BackendServiceArgs;
    import com.pulumi.gcp.compute.URLMap;
    import com.pulumi.gcp.compute.URLMapArgs;
    import com.pulumi.gcp.compute.inputs.URLMapHostRuleArgs;
    import com.pulumi.gcp.compute.inputs.URLMapPathMatcherArgs;
    import com.pulumi.gcp.compute.TargetHttpProxy;
    import com.pulumi.gcp.compute.TargetHttpProxyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder()
                .name("http-health-check")
                .requestPath("/")
                .checkIntervalSec(1)
                .timeoutSec(1)
                .build());
    
            var defaultBackendService = new BackendService("defaultBackendService", BackendServiceArgs.builder()
                .name("backend-service")
                .portName("http")
                .protocol("HTTP")
                .timeoutSec(10)
                .loadBalancingScheme("EXTERNAL_MANAGED")
                .healthChecks(defaultHttpHealthCheck.id())
                .build());
    
            var defaultURLMap = new URLMap("defaultURLMap", URLMapArgs.builder()
                .name("url-map")
                .defaultService(defaultBackendService.id())
                .hostRules(URLMapHostRuleArgs.builder()
                    .hosts("mysite.com")
                    .pathMatcher("allpaths")
                    .build())
                .pathMatchers(URLMapPathMatcherArgs.builder()
                    .name("allpaths")
                    .defaultService(defaultBackendService.id())
                    .pathRules(URLMapPathMatcherPathRuleArgs.builder()
                        .paths("/*")
                        .service(defaultBackendService.id())
                        .build())
                    .build())
                .build());
    
            var default_ = new TargetHttpProxy("default", TargetHttpProxyArgs.builder()
                .name("test-http-keep-alive-timeout-proxy")
                .httpKeepAliveTimeoutSec(610)
                .urlMap(defaultURLMap.id())
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:TargetHttpProxy
        properties:
          name: test-http-keep-alive-timeout-proxy
          httpKeepAliveTimeoutSec: 610
          urlMap: ${defaultURLMap.id}
      defaultURLMap:
        type: gcp:compute:URLMap
        name: default
        properties:
          name: url-map
          defaultService: ${defaultBackendService.id}
          hostRules:
            - hosts:
                - mysite.com
              pathMatcher: allpaths
          pathMatchers:
            - name: allpaths
              defaultService: ${defaultBackendService.id}
              pathRules:
                - paths:
                    - /*
                  service: ${defaultBackendService.id}
      defaultBackendService:
        type: gcp:compute:BackendService
        name: default
        properties:
          name: backend-service
          portName: http
          protocol: HTTP
          timeoutSec: 10
          loadBalancingScheme: EXTERNAL_MANAGED
          healthChecks: ${defaultHttpHealthCheck.id}
      defaultHttpHealthCheck:
        type: gcp:compute:HttpHealthCheck
        name: default
        properties:
          name: http-health-check
          requestPath: /
          checkIntervalSec: 1
          timeoutSec: 1
    

    Target Http Proxy Https Redirect

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const defaultURLMap = new gcp.compute.URLMap("default", {
        name: "url-map",
        defaultUrlRedirect: {
            httpsRedirect: true,
            stripQuery: false,
        },
    });
    const _default = new gcp.compute.TargetHttpProxy("default", {
        name: "test-https-redirect-proxy",
        urlMap: defaultURLMap.id,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default_url_map = gcp.compute.URLMap("default",
        name="url-map",
        default_url_redirect=gcp.compute.URLMapDefaultUrlRedirectArgs(
            https_redirect=True,
            strip_query=False,
        ))
    default = gcp.compute.TargetHttpProxy("default",
        name="test-https-redirect-proxy",
        url_map=default_url_map.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		defaultURLMap, err := compute.NewURLMap(ctx, "default", &compute.URLMapArgs{
    			Name: pulumi.String("url-map"),
    			DefaultUrlRedirect: &compute.URLMapDefaultUrlRedirectArgs{
    				HttpsRedirect: pulumi.Bool(true),
    				StripQuery:    pulumi.Bool(false),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewTargetHttpProxy(ctx, "default", &compute.TargetHttpProxyArgs{
    			Name:   pulumi.String("test-https-redirect-proxy"),
    			UrlMap: defaultURLMap.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var defaultURLMap = new Gcp.Compute.URLMap("default", new()
        {
            Name = "url-map",
            DefaultUrlRedirect = new Gcp.Compute.Inputs.URLMapDefaultUrlRedirectArgs
            {
                HttpsRedirect = true,
                StripQuery = false,
            },
        });
    
        var @default = new Gcp.Compute.TargetHttpProxy("default", new()
        {
            Name = "test-https-redirect-proxy",
            UrlMap = defaultURLMap.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.URLMap;
    import com.pulumi.gcp.compute.URLMapArgs;
    import com.pulumi.gcp.compute.inputs.URLMapDefaultUrlRedirectArgs;
    import com.pulumi.gcp.compute.TargetHttpProxy;
    import com.pulumi.gcp.compute.TargetHttpProxyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var defaultURLMap = new URLMap("defaultURLMap", URLMapArgs.builder()
                .name("url-map")
                .defaultUrlRedirect(URLMapDefaultUrlRedirectArgs.builder()
                    .httpsRedirect(true)
                    .stripQuery(false)
                    .build())
                .build());
    
            var default_ = new TargetHttpProxy("default", TargetHttpProxyArgs.builder()
                .name("test-https-redirect-proxy")
                .urlMap(defaultURLMap.id())
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:TargetHttpProxy
        properties:
          name: test-https-redirect-proxy
          urlMap: ${defaultURLMap.id}
      defaultURLMap:
        type: gcp:compute:URLMap
        name: default
        properties:
          name: url-map
          defaultUrlRedirect:
            httpsRedirect: true
            stripQuery: false
    

    Create TargetHttpProxy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new TargetHttpProxy(name: string, args: TargetHttpProxyArgs, opts?: CustomResourceOptions);
    @overload
    def TargetHttpProxy(resource_name: str,
                        args: TargetHttpProxyArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def TargetHttpProxy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        url_map: Optional[str] = None,
                        description: Optional[str] = None,
                        http_keep_alive_timeout_sec: Optional[int] = None,
                        name: Optional[str] = None,
                        project: Optional[str] = None,
                        proxy_bind: Optional[bool] = None)
    func NewTargetHttpProxy(ctx *Context, name string, args TargetHttpProxyArgs, opts ...ResourceOption) (*TargetHttpProxy, error)
    public TargetHttpProxy(string name, TargetHttpProxyArgs args, CustomResourceOptions? opts = null)
    public TargetHttpProxy(String name, TargetHttpProxyArgs args)
    public TargetHttpProxy(String name, TargetHttpProxyArgs args, CustomResourceOptions options)
    
    type: gcp:compute:TargetHttpProxy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args TargetHttpProxyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args TargetHttpProxyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args TargetHttpProxyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TargetHttpProxyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TargetHttpProxyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var targetHttpProxyResource = new Gcp.Compute.TargetHttpProxy("targetHttpProxyResource", new()
    {
        UrlMap = "string",
        Description = "string",
        HttpKeepAliveTimeoutSec = 0,
        Name = "string",
        Project = "string",
        ProxyBind = false,
    });
    
    example, err := compute.NewTargetHttpProxy(ctx, "targetHttpProxyResource", &compute.TargetHttpProxyArgs{
    	UrlMap:                  pulumi.String("string"),
    	Description:             pulumi.String("string"),
    	HttpKeepAliveTimeoutSec: pulumi.Int(0),
    	Name:                    pulumi.String("string"),
    	Project:                 pulumi.String("string"),
    	ProxyBind:               pulumi.Bool(false),
    })
    
    var targetHttpProxyResource = new TargetHttpProxy("targetHttpProxyResource", TargetHttpProxyArgs.builder()
        .urlMap("string")
        .description("string")
        .httpKeepAliveTimeoutSec(0)
        .name("string")
        .project("string")
        .proxyBind(false)
        .build());
    
    target_http_proxy_resource = gcp.compute.TargetHttpProxy("targetHttpProxyResource",
        url_map="string",
        description="string",
        http_keep_alive_timeout_sec=0,
        name="string",
        project="string",
        proxy_bind=False)
    
    const targetHttpProxyResource = new gcp.compute.TargetHttpProxy("targetHttpProxyResource", {
        urlMap: "string",
        description: "string",
        httpKeepAliveTimeoutSec: 0,
        name: "string",
        project: "string",
        proxyBind: false,
    });
    
    type: gcp:compute:TargetHttpProxy
    properties:
        description: string
        httpKeepAliveTimeoutSec: 0
        name: string
        project: string
        proxyBind: false
        urlMap: string
    

    TargetHttpProxy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The TargetHttpProxy resource accepts the following input properties:

    UrlMap string
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    Description string
    An optional description of this resource.
    HttpKeepAliveTimeoutSec int
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    Name string
    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? 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.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    ProxyBind bool
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    UrlMap string
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    Description string
    An optional description of this resource.
    HttpKeepAliveTimeoutSec int
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    Name string
    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? 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.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    ProxyBind bool
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    urlMap String
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    description String
    An optional description of this resource.
    httpKeepAliveTimeoutSec Integer
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name String
    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? 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.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxyBind Boolean
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    urlMap string
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    description string
    An optional description of this resource.
    httpKeepAliveTimeoutSec number
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name string
    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? 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.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxyBind boolean
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    url_map str
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    description str
    An optional description of this resource.
    http_keep_alive_timeout_sec int
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name str
    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? 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.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxy_bind bool
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    urlMap String
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    description String
    An optional description of this resource.
    httpKeepAliveTimeoutSec Number
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name String
    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? 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.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxyBind Boolean
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TargetHttpProxy resource produces the following output properties:

    CreationTimestamp string
    Creation timestamp in RFC3339 text format.
    Id string
    The provider-assigned unique ID for this managed resource.
    ProxyId int
    The unique identifier for the resource.
    SelfLink string
    The URI of the created resource.
    CreationTimestamp string
    Creation timestamp in RFC3339 text format.
    Id string
    The provider-assigned unique ID for this managed resource.
    ProxyId int
    The unique identifier for the resource.
    SelfLink string
    The URI of the created resource.
    creationTimestamp String
    Creation timestamp in RFC3339 text format.
    id String
    The provider-assigned unique ID for this managed resource.
    proxyId Integer
    The unique identifier for the resource.
    selfLink String
    The URI of the created resource.
    creationTimestamp string
    Creation timestamp in RFC3339 text format.
    id string
    The provider-assigned unique ID for this managed resource.
    proxyId number
    The unique identifier for the resource.
    selfLink string
    The URI of the created resource.
    creation_timestamp str
    Creation timestamp in RFC3339 text format.
    id str
    The provider-assigned unique ID for this managed resource.
    proxy_id int
    The unique identifier for the resource.
    self_link str
    The URI of the created resource.
    creationTimestamp String
    Creation timestamp in RFC3339 text format.
    id String
    The provider-assigned unique ID for this managed resource.
    proxyId Number
    The unique identifier for the resource.
    selfLink String
    The URI of the created resource.

    Look up Existing TargetHttpProxy Resource

    Get an existing TargetHttpProxy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: TargetHttpProxyState, opts?: CustomResourceOptions): TargetHttpProxy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            creation_timestamp: Optional[str] = None,
            description: Optional[str] = None,
            http_keep_alive_timeout_sec: Optional[int] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            proxy_bind: Optional[bool] = None,
            proxy_id: Optional[int] = None,
            self_link: Optional[str] = None,
            url_map: Optional[str] = None) -> TargetHttpProxy
    func GetTargetHttpProxy(ctx *Context, name string, id IDInput, state *TargetHttpProxyState, opts ...ResourceOption) (*TargetHttpProxy, error)
    public static TargetHttpProxy Get(string name, Input<string> id, TargetHttpProxyState? state, CustomResourceOptions? opts = null)
    public static TargetHttpProxy get(String name, Output<String> id, TargetHttpProxyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreationTimestamp string
    Creation timestamp in RFC3339 text format.
    Description string
    An optional description of this resource.
    HttpKeepAliveTimeoutSec int
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    Name string
    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? 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.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    ProxyBind bool
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    ProxyId int
    The unique identifier for the resource.
    SelfLink string
    The URI of the created resource.
    UrlMap string
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    CreationTimestamp string
    Creation timestamp in RFC3339 text format.
    Description string
    An optional description of this resource.
    HttpKeepAliveTimeoutSec int
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    Name string
    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? 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.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    ProxyBind bool
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    ProxyId int
    The unique identifier for the resource.
    SelfLink string
    The URI of the created resource.
    UrlMap string
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    creationTimestamp String
    Creation timestamp in RFC3339 text format.
    description String
    An optional description of this resource.
    httpKeepAliveTimeoutSec Integer
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name String
    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? 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.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxyBind Boolean
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    proxyId Integer
    The unique identifier for the resource.
    selfLink String
    The URI of the created resource.
    urlMap String
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    creationTimestamp string
    Creation timestamp in RFC3339 text format.
    description string
    An optional description of this resource.
    httpKeepAliveTimeoutSec number
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name string
    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? 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.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxyBind boolean
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    proxyId number
    The unique identifier for the resource.
    selfLink string
    The URI of the created resource.
    urlMap string
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    creation_timestamp str
    Creation timestamp in RFC3339 text format.
    description str
    An optional description of this resource.
    http_keep_alive_timeout_sec int
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name str
    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? 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.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxy_bind bool
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    proxy_id int
    The unique identifier for the resource.
    self_link str
    The URI of the created resource.
    url_map str
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    creationTimestamp String
    Creation timestamp in RFC3339 text format.
    description String
    An optional description of this resource.
    httpKeepAliveTimeoutSec Number
    Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keepalive is not specified, a default value (610 seconds) will be used. For Global external HTTP(S) load balancer, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For Global external HTTP(S) load balancer (classic), this option is not available publicly.
    name String
    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? 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.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    proxyBind Boolean
    This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED.
    proxyId Number
    The unique identifier for the resource.
    selfLink String
    The URI of the created resource.
    urlMap String
    A reference to the UrlMap resource that defines the mapping from URL to the BackendService.


    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}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.27.0 published on Thursday, Jun 13, 2024 by Pulumi