RegionUrlMapArgs

data class RegionUrlMapArgs(val defaultRouteAction: Output<RegionUrlMapDefaultRouteActionArgs>? = null, val defaultService: Output<String>? = null, val defaultUrlRedirect: Output<RegionUrlMapDefaultUrlRedirectArgs>? = null, val description: Output<String>? = null, val hostRules: Output<List<RegionUrlMapHostRuleArgs>>? = null, val name: Output<String>? = null, val pathMatchers: Output<List<RegionUrlMapPathMatcherArgs>>? = null, val project: Output<String>? = null, val region: Output<String>? = null, val tests: Output<List<RegionUrlMapTestArgs>>? = null) : ConvertibleToJava<RegionUrlMapArgs>

UrlMaps are used to route requests to a backend service based on rules that you define for the host and path of an incoming URL.

Example Usage

Region Url Map Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.RegionHealthCheck;
import com.pulumi.gcp.compute.RegionHealthCheckArgs;
import com.pulumi.gcp.compute.inputs.RegionHealthCheckHttpHealthCheckArgs;
import com.pulumi.gcp.compute.RegionBackendService;
import com.pulumi.gcp.compute.RegionBackendServiceArgs;
import com.pulumi.gcp.compute.RegionUrlMap;
import com.pulumi.gcp.compute.RegionUrlMapArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapHostRuleArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapPathMatcherArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapTestArgs;
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 default_ = new RegionHealthCheck("default", RegionHealthCheckArgs.builder()
.region("us-central1")
.checkIntervalSec(1)
.timeoutSec(1)
.httpHealthCheck(RegionHealthCheckHttpHealthCheckArgs.builder()
.port(80)
.requestPath("/")
.build())
.build());
var login = new RegionBackendService("login", RegionBackendServiceArgs.builder()
.region("us-central1")
.protocol("HTTP")
.loadBalancingScheme("INTERNAL_MANAGED")
.timeoutSec(10)
.healthChecks(default_.id())
.build());
var home = new RegionBackendService("home", RegionBackendServiceArgs.builder()
.region("us-central1")
.protocol("HTTP")
.loadBalancingScheme("INTERNAL_MANAGED")
.timeoutSec(10)
.healthChecks(default_.id())
.build());
var regionurlmap = new RegionUrlMap("regionurlmap", RegionUrlMapArgs.builder()
.region("us-central1")
.description("a description")
.defaultService(home.id())
.hostRules(RegionUrlMapHostRuleArgs.builder()
.hosts("mysite.com")
.pathMatcher("allpaths")
.build())
.pathMatchers(RegionUrlMapPathMatcherArgs.builder()
.name("allpaths")
.defaultService(home.id())
.pathRules(
RegionUrlMapPathMatcherPathRuleArgs.builder()
.paths("/home")
.service(home.id())
.build(),
RegionUrlMapPathMatcherPathRuleArgs.builder()
.paths("/login")
.service(login.id())
.build())
.build())
.tests(RegionUrlMapTestArgs.builder()
.service(home.id())
.host("hi.com")
.path("/home")
.build())
.build());
}
}

Region Url Map Default Route Action

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.RegionHealthCheck;
import com.pulumi.gcp.compute.RegionHealthCheckArgs;
import com.pulumi.gcp.compute.inputs.RegionHealthCheckHttpHealthCheckArgs;
import com.pulumi.gcp.compute.RegionBackendService;
import com.pulumi.gcp.compute.RegionBackendServiceArgs;
import com.pulumi.gcp.compute.RegionUrlMap;
import com.pulumi.gcp.compute.RegionUrlMapArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionRetryPolicyArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionRetryPolicyPerTryTimeoutArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionRequestMirrorPolicyArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionUrlRewriteArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionCorsPolicyArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionFaultInjectionPolicyArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionFaultInjectionPolicyDelayArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionFaultInjectionPolicyDelayFixedDelayArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbortArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultRouteActionTimeoutArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapHostRuleArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapPathMatcherArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapTestArgs;
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 default_ = new RegionHealthCheck("default", RegionHealthCheckArgs.builder()
.region("us-central1")
.checkIntervalSec(1)
.timeoutSec(1)
.httpHealthCheck(RegionHealthCheckHttpHealthCheckArgs.builder()
.port(80)
.requestPath("/")
.build())
.build());
var login = new RegionBackendService("login", RegionBackendServiceArgs.builder()
.region("us-central1")
.protocol("HTTP")
.loadBalancingScheme("INTERNAL_MANAGED")
.timeoutSec(10)
.healthChecks(default_.id())
.build());
var home = new RegionBackendService("home", RegionBackendServiceArgs.builder()
.region("us-central1")
.protocol("HTTP")
.loadBalancingScheme("INTERNAL_MANAGED")
.timeoutSec(10)
.healthChecks(default_.id())
.build());
var regionurlmap = new RegionUrlMap("regionurlmap", RegionUrlMapArgs.builder()
.region("us-central1")
.description("a description")
.defaultRouteAction(RegionUrlMapDefaultRouteActionArgs.builder()
.retryPolicy(RegionUrlMapDefaultRouteActionRetryPolicyArgs.builder()
.retryConditions(
"5xx",
"gateway-error")
.numRetries(3)
.perTryTimeout(RegionUrlMapDefaultRouteActionRetryPolicyPerTryTimeoutArgs.builder()
.seconds(0)
.nanos(500)
.build())
.build())
.requestMirrorPolicy(RegionUrlMapDefaultRouteActionRequestMirrorPolicyArgs.builder()
.backendService(home.id())
.build())
.weightedBackendServices(
RegionUrlMapDefaultRouteActionWeightedBackendServiceArgs.builder()
.backendService(login.id())
.weight(200)
.headerAction(RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionArgs.builder()
.requestHeadersToAdds(RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionRequestHeadersToAddArgs.builder()
.headerName("foo-request-1")
.headerValue("bar")
.replace(true)
.build())
.requestHeadersToRemoves("fizz")
.responseHeadersToAdds(RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionResponseHeadersToAddArgs.builder()
.headerName("foo-response-1")
.headerValue("bar")
.replace(true)
.build())
.responseHeadersToRemoves("buzz")
.build())
.build(),
RegionUrlMapDefaultRouteActionWeightedBackendServiceArgs.builder()
.backendService(home.id())
.weight(100)
.headerAction(RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionArgs.builder()
.requestHeadersToAdds(
RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionRequestHeadersToAddArgs.builder()
.headerName("foo-request-1")
.headerValue("bar")
.replace(true)
.build(),
RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionRequestHeadersToAddArgs.builder()
.headerName("foo-request-2")
.headerValue("bar")
.replace(true)
.build())
.requestHeadersToRemoves("fizz")
.responseHeadersToAdds(
RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionResponseHeadersToAddArgs.builder()
.headerName("foo-response-2")
.headerValue("bar")
.replace(true)
.build(),
RegionUrlMapDefaultRouteActionWeightedBackendServiceHeaderActionResponseHeadersToAddArgs.builder()
.headerName("foo-response-1")
.headerValue("bar")
.replace(true)
.build())
.responseHeadersToRemoves("buzz")
.build())
.build())
.urlRewrite(RegionUrlMapDefaultRouteActionUrlRewriteArgs.builder()
.hostRewrite("dev.example.com")
.pathPrefixRewrite("/v1/api/")
.build())
.corsPolicy(RegionUrlMapDefaultRouteActionCorsPolicyArgs.builder()
.disabled(false)
.allowCredentials(true)
.allowHeaders("foobar")
.allowMethods(
"GET",
"POST")
.allowOrigins("example.com")
.exposeHeaders("foobar")
.maxAge(60)
.build())
.faultInjectionPolicy(RegionUrlMapDefaultRouteActionFaultInjectionPolicyArgs.builder()
.delay(RegionUrlMapDefaultRouteActionFaultInjectionPolicyDelayArgs.builder()
.fixedDelay(RegionUrlMapDefaultRouteActionFaultInjectionPolicyDelayFixedDelayArgs.builder()
.seconds(0)
.nanos(500)
.build())
.percentage(0.5)
.build())
.abort(RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbortArgs.builder()
.httpStatus(500)
.percentage(0.5)
.build())
.build())
.timeout(RegionUrlMapDefaultRouteActionTimeoutArgs.builder()
.seconds(0)
.nanos(500)
.build())
.build())
.hostRules(RegionUrlMapHostRuleArgs.builder()
.hosts("mysite.com")
.pathMatcher("allpaths")
.build())
.pathMatchers(RegionUrlMapPathMatcherArgs.builder()
.name("allpaths")
.defaultService(home.id())
.pathRules(
RegionUrlMapPathMatcherPathRuleArgs.builder()
.paths("/home")
.service(home.id())
.build(),
RegionUrlMapPathMatcherPathRuleArgs.builder()
.paths("/login")
.service(login.id())
.build())
.build())
.tests(RegionUrlMapTestArgs.builder()
.service(home.id())
.host("hi.com")
.path("/home")
.build())
.build());
}
}

Region Url Map L7 Ilb Path

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.RegionHealthCheck;
import com.pulumi.gcp.compute.RegionHealthCheckArgs;
import com.pulumi.gcp.compute.inputs.RegionHealthCheckHttpHealthCheckArgs;
import com.pulumi.gcp.compute.RegionBackendService;
import com.pulumi.gcp.compute.RegionBackendServiceArgs;
import com.pulumi.gcp.compute.RegionUrlMap;
import com.pulumi.gcp.compute.RegionUrlMapArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapHostRuleArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapPathMatcherArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapTestArgs;
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 default_ = new RegionHealthCheck("default", RegionHealthCheckArgs.builder()
.httpHealthCheck(RegionHealthCheckHttpHealthCheckArgs.builder()
.port(80)
.build())
.build());
var home = new RegionBackendService("home", RegionBackendServiceArgs.builder()
.protocol("HTTP")
.timeoutSec(10)
.healthChecks(default_.id())
.loadBalancingScheme("INTERNAL_MANAGED")
.build());
var regionurlmap = new RegionUrlMap("regionurlmap", RegionUrlMapArgs.builder()
.description("a description")
.defaultService(home.id())
.hostRules(RegionUrlMapHostRuleArgs.builder()
.hosts("mysite.com")
.pathMatcher("allpaths")
.build())
.pathMatchers(RegionUrlMapPathMatcherArgs.builder()
.name("allpaths")
.defaultService(home.id())
.pathRules(RegionUrlMapPathMatcherPathRuleArgs.builder()
.paths("/home")
.routeAction(RegionUrlMapPathMatcherPathRuleRouteActionArgs.builder()
.corsPolicy(RegionUrlMapPathMatcherPathRuleRouteActionCorsPolicyArgs.builder()
.allowCredentials(true)
.allowHeaders("Allowed content")
.allowMethods("GET")
.allowOrigins("Allowed origin")
.exposeHeaders("Exposed header")
.maxAge(30)
.disabled(false)
.build())
.faultInjectionPolicy(RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyArgs.builder()
.abort(RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortArgs.builder()
.httpStatus(234)
.percentage(5.6)
.build())
.delay(RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyDelayArgs.builder()
.fixedDelay(RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyDelayFixedDelayArgs.builder()
.seconds(0)
.nanos(50000)
.build())
.percentage(7.8)
.build())
.build())
.requestMirrorPolicy(RegionUrlMapPathMatcherPathRuleRouteActionRequestMirrorPolicyArgs.builder()
.backendService(home.id())
.build())
.retryPolicy(RegionUrlMapPathMatcherPathRuleRouteActionRetryPolicyArgs.builder()
.numRetries(4)
.perTryTimeout(RegionUrlMapPathMatcherPathRuleRouteActionRetryPolicyPerTryTimeoutArgs.builder()
.seconds(30)
.build())
.retryConditions(
"5xx",
"deadline-exceeded")
.build())
.timeout(RegionUrlMapPathMatcherPathRuleRouteActionTimeoutArgs.builder()
.seconds(20)
.nanos(750000000)
.build())
.urlRewrite(RegionUrlMapPathMatcherPathRuleRouteActionUrlRewriteArgs.builder()
.hostRewrite("dev.example.com")
.pathPrefixRewrite("/v1/api/")
.build())
.weightedBackendServices(RegionUrlMapPathMatcherPathRuleRouteActionWeightedBackendServiceArgs.builder()
.backendService(home.id())
.weight(400)
.headerAction(RegionUrlMapPathMatcherPathRuleRouteActionWeightedBackendServiceHeaderActionArgs.builder()
.requestHeadersToRemoves("RemoveMe")
.requestHeadersToAdds(RegionUrlMapPathMatcherPathRuleRouteActionWeightedBackendServiceHeaderActionRequestHeadersToAddArgs.builder()
.headerName("AddMe")
.headerValue("MyValue")
.replace(true)
.build())
.responseHeadersToRemoves("RemoveMe")
.responseHeadersToAdds(RegionUrlMapPathMatcherPathRuleRouteActionWeightedBackendServiceHeaderActionResponseHeadersToAddArgs.builder()
.headerName("AddMe")
.headerValue("MyValue")
.replace(false)
.build())
.build())
.build())
.build())
.build())
.build())
.tests(RegionUrlMapTestArgs.builder()
.service(home.id())
.host("hi.com")
.path("/home")
.build())
.build());
}
}

Region Url Map L7 Ilb Path Partial

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.RegionHealthCheck;
import com.pulumi.gcp.compute.RegionHealthCheckArgs;
import com.pulumi.gcp.compute.inputs.RegionHealthCheckHttpHealthCheckArgs;
import com.pulumi.gcp.compute.RegionBackendService;
import com.pulumi.gcp.compute.RegionBackendServiceArgs;
import com.pulumi.gcp.compute.RegionUrlMap;
import com.pulumi.gcp.compute.RegionUrlMapArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapHostRuleArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapPathMatcherArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapTestArgs;
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 default_ = new RegionHealthCheck("default", RegionHealthCheckArgs.builder()
.httpHealthCheck(RegionHealthCheckHttpHealthCheckArgs.builder()
.port(80)
.build())
.build());
var home = new RegionBackendService("home", RegionBackendServiceArgs.builder()
.protocol("HTTP")
.timeoutSec(10)
.healthChecks(default_.id())
.loadBalancingScheme("INTERNAL_MANAGED")
.build());
var regionurlmap = new RegionUrlMap("regionurlmap", RegionUrlMapArgs.builder()
.description("a description")
.defaultService(home.id())
.hostRules(RegionUrlMapHostRuleArgs.builder()
.hosts("mysite.com")
.pathMatcher("allpaths")
.build())
.pathMatchers(RegionUrlMapPathMatcherArgs.builder()
.name("allpaths")
.defaultService(home.id())
.pathRules(RegionUrlMapPathMatcherPathRuleArgs.builder()
.paths("/home")
.routeAction(RegionUrlMapPathMatcherPathRuleRouteActionArgs.builder()
.retryPolicy(RegionUrlMapPathMatcherPathRuleRouteActionRetryPolicyArgs.builder()
.numRetries(4)
.perTryTimeout(RegionUrlMapPathMatcherPathRuleRouteActionRetryPolicyPerTryTimeoutArgs.builder()
.seconds(30)
.build())
.retryConditions(
"5xx",
"deadline-exceeded")
.build())
.timeout(RegionUrlMapPathMatcherPathRuleRouteActionTimeoutArgs.builder()
.seconds(20)
.nanos(750000000)
.build())
.urlRewrite(RegionUrlMapPathMatcherPathRuleRouteActionUrlRewriteArgs.builder()
.hostRewrite("dev.example.com")
.pathPrefixRewrite("/v1/api/")
.build())
.weightedBackendServices(RegionUrlMapPathMatcherPathRuleRouteActionWeightedBackendServiceArgs.builder()
.backendService(home.id())
.weight(400)
.headerAction(RegionUrlMapPathMatcherPathRuleRouteActionWeightedBackendServiceHeaderActionArgs.builder()
.responseHeadersToAdds(RegionUrlMapPathMatcherPathRuleRouteActionWeightedBackendServiceHeaderActionResponseHeadersToAddArgs.builder()
.headerName("AddMe")
.headerValue("MyValue")
.replace(false)
.build())
.build())
.build())
.build())
.build())
.build())
.tests(RegionUrlMapTestArgs.builder()
.service(home.id())
.host("hi.com")
.path("/home")
.build())
.build());
}
}

Region Url Map L7 Ilb Route

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.RegionHealthCheck;
import com.pulumi.gcp.compute.RegionHealthCheckArgs;
import com.pulumi.gcp.compute.inputs.RegionHealthCheckHttpHealthCheckArgs;
import com.pulumi.gcp.compute.RegionBackendService;
import com.pulumi.gcp.compute.RegionBackendServiceArgs;
import com.pulumi.gcp.compute.RegionUrlMap;
import com.pulumi.gcp.compute.RegionUrlMapArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapHostRuleArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapPathMatcherArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapTestArgs;
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 default_ = new RegionHealthCheck("default", RegionHealthCheckArgs.builder()
.httpHealthCheck(RegionHealthCheckHttpHealthCheckArgs.builder()
.port(80)
.build())
.build());
var home = new RegionBackendService("home", RegionBackendServiceArgs.builder()
.protocol("HTTP")
.timeoutSec(10)
.healthChecks(default_.id())
.loadBalancingScheme("INTERNAL_MANAGED")
.build());
var regionurlmap = new RegionUrlMap("regionurlmap", RegionUrlMapArgs.builder()
.description("a description")
.defaultService(home.id())
.hostRules(RegionUrlMapHostRuleArgs.builder()
.hosts("mysite.com")
.pathMatcher("allpaths")
.build())
.pathMatchers(RegionUrlMapPathMatcherArgs.builder()
.name("allpaths")
.defaultService(home.id())
.routeRules(RegionUrlMapPathMatcherRouteRuleArgs.builder()
.priority(1)
.headerAction(RegionUrlMapPathMatcherRouteRuleHeaderActionArgs.builder()
.requestHeadersToRemoves("RemoveMe2")
.requestHeadersToAdds(RegionUrlMapPathMatcherRouteRuleHeaderActionRequestHeadersToAddArgs.builder()
.headerName("AddSomethingElse")
.headerValue("MyOtherValue")
.replace(true)
.build())
.responseHeadersToRemoves("RemoveMe3")
.responseHeadersToAdds(RegionUrlMapPathMatcherRouteRuleHeaderActionResponseHeadersToAddArgs.builder()
.headerName("AddMe")
.headerValue("MyValue")
.replace(false)
.build())
.build())
.matchRules(RegionUrlMapPathMatcherRouteRuleMatchRuleArgs.builder()
.fullPathMatch("a full path")
.headerMatches(RegionUrlMapPathMatcherRouteRuleMatchRuleHeaderMatchArgs.builder()
.headerName("someheader")
.exactMatch("match this exactly")
.invertMatch(true)
.build())
.ignoreCase(true)
.metadataFilters(RegionUrlMapPathMatcherRouteRuleMatchRuleMetadataFilterArgs.builder()
.filterMatchCriteria("MATCH_ANY")
.filterLabels(RegionUrlMapPathMatcherRouteRuleMatchRuleMetadataFilterFilterLabelArgs.builder()
.name("PLANET")
.value("MARS")
.build())
.build())
.queryParameterMatches(RegionUrlMapPathMatcherRouteRuleMatchRuleQueryParameterMatchArgs.builder()
.name("a query parameter")
.presentMatch(true)
.build())
.build())
.urlRedirect(RegionUrlMapPathMatcherRouteRuleUrlRedirectArgs.builder()
.hostRedirect("A host")
.httpsRedirect(false)
.pathRedirect("some/path")
.redirectResponseCode("TEMPORARY_REDIRECT")
.stripQuery(true)
.build())
.build())
.build())
.tests(RegionUrlMapTestArgs.builder()
.service(home.id())
.host("hi.com")
.path("/home")
.build())
.build());
}
}

Region Url Map L7 Ilb Route Partial

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.RegionHealthCheck;
import com.pulumi.gcp.compute.RegionHealthCheckArgs;
import com.pulumi.gcp.compute.inputs.RegionHealthCheckHttpHealthCheckArgs;
import com.pulumi.gcp.compute.RegionBackendService;
import com.pulumi.gcp.compute.RegionBackendServiceArgs;
import com.pulumi.gcp.compute.RegionUrlMap;
import com.pulumi.gcp.compute.RegionUrlMapArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapHostRuleArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapPathMatcherArgs;
import com.pulumi.gcp.compute.inputs.RegionUrlMapTestArgs;
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 default_ = new RegionHealthCheck("default", RegionHealthCheckArgs.builder()
.httpHealthCheck(RegionHealthCheckHttpHealthCheckArgs.builder()
.port(80)
.build())
.build());
var home = new RegionBackendService("home", RegionBackendServiceArgs.builder()
.protocol("HTTP")
.timeoutSec(10)
.healthChecks(default_.id())
.loadBalancingScheme("INTERNAL_MANAGED")
.build());
var regionurlmap = new RegionUrlMap("regionurlmap", RegionUrlMapArgs.builder()
.description("a description")
.defaultService(home.id())
.hostRules(RegionUrlMapHostRuleArgs.builder()
.hosts("mysite.com")
.pathMatcher("allpaths")
.build())
.pathMatchers(RegionUrlMapPathMatcherArgs.builder()
.name("allpaths")
.defaultService(home.id())
.routeRules(RegionUrlMapPathMatcherRouteRuleArgs.builder()
.priority(1)
.service(home.id())
.headerAction(RegionUrlMapPathMatcherRouteRuleHeaderActionArgs.builder()
.requestHeadersToRemoves("RemoveMe2")
.build())
.matchRules(RegionUrlMapPathMatcherRouteRuleMatchRuleArgs.builder()
.fullPathMatch("a full path")
.headerMatches(RegionUrlMapPathMatcherRouteRuleMatchRuleHeaderMatchArgs.builder()
.headerName("someheader")
.exactMatch("match this exactly")
.invertMatch(true)
.build())
.queryParameterMatches(RegionUrlMapPathMatcherRouteRuleMatchRuleQueryParameterMatchArgs.builder()
.name("a query parameter")
.presentMatch(true)
.build())
.build())
.build())
.build())
.tests(RegionUrlMapTestArgs.builder()
.service(home.id())
.host("hi.com")
.path("/home")
.build())
.build());
}
}

Import

RegionUrlMap can be imported using any of these accepted formats

$ pulumi import gcp:compute/regionUrlMap:RegionUrlMap default projects/{{project}}/regions/{{region}}/urlMaps/{{name}}
$ pulumi import gcp:compute/regionUrlMap:RegionUrlMap default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/regionUrlMap:RegionUrlMap default {{region}}/{{name}}
$ pulumi import gcp:compute/regionUrlMap:RegionUrlMap default {{name}}

Constructors

Link copied to clipboard
constructor(defaultRouteAction: Output<RegionUrlMapDefaultRouteActionArgs>? = null, defaultService: Output<String>? = null, defaultUrlRedirect: Output<RegionUrlMapDefaultUrlRedirectArgs>? = null, description: Output<String>? = null, hostRules: Output<List<RegionUrlMapHostRuleArgs>>? = null, name: Output<String>? = null, pathMatchers: Output<List<RegionUrlMapPathMatcherArgs>>? = null, project: Output<String>? = null, region: Output<String>? = null, tests: Output<List<RegionUrlMapTestArgs>>? = null)

Properties

Link copied to clipboard

defaultRouteAction takes effect when none of the hostRules match. The load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If defaultRouteAction specifies any weightedBackendServices, defaultService must not be set. Conversely if defaultService is set, defaultRouteAction cannot contain any weightedBackendServices. Only one of defaultRouteAction or defaultUrlRedirect must be set. URL maps for Classic external HTTP(S) load balancers only support the urlRewrite action within defaultRouteAction. defaultRouteAction has no effect when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true. Structure is documented below.

Link copied to clipboard
val defaultService: Output<String>? = null

The full or partial URL of the defaultService resource to which traffic is directed if none of the hostRules match. If defaultRouteAction is additionally specified, advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to the backend. However, if defaultService is specified, defaultRouteAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of defaultService, defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set.

Link copied to clipboard

When none of the specified hostRules match, the request is redirected to a URL specified by defaultUrlRedirect. If defaultUrlRedirect is specified, defaultService or defaultRouteAction must not be set. Structure is documented below.

Link copied to clipboard
val description: Output<String>? = null

An optional description of this resource. Provide this property when you create the resource.

Link copied to clipboard

The list of HostRules to use against the URL. Structure is documented below.

Link copied to clipboard
val name: Output<String>? = null

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.

Link copied to clipboard

The list of named PathMatchers to use against the URL. Structure is documented below.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val region: Output<String>? = null

The Region in which the url map should reside. If it is not provided, the provider region is used.

Link copied to clipboard
val tests: Output<List<RegionUrlMapTestArgs>>? = null

The list of expected URL mappings. Requests to update this UrlMap will succeed only if all of the test cases pass. Structure is documented below.

Functions

Link copied to clipboard
open override fun toJava(): RegionUrlMapArgs