kong.Route
Explore with Pulumi AI
# kong.Route
The route resource maps directly onto the json for the route endpoint in Kong. For more information on the parameters see the Kong Route create documentation.
To create a tcp/tls route you set sources
and destinations
by repeating the corresponding element (source
or destination
) for each source or destination you want.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as kong from "@pulumi/kong";
const route = new kong.Route("route", {
name: "MyRoute",
protocols: [
"http",
"https",
],
methods: [
"GET",
"POST",
],
hosts: ["example2.com"],
paths: ["/test"],
stripPath: false,
preserveHost: true,
regexPriority: 1,
serviceId: service.id,
headers: [{
name: "x-test-1",
values: [
"a",
"b",
],
}],
});
import pulumi
import pulumi_kong as kong
route = kong.Route("route",
name="MyRoute",
protocols=[
"http",
"https",
],
methods=[
"GET",
"POST",
],
hosts=["example2.com"],
paths=["/test"],
strip_path=False,
preserve_host=True,
regex_priority=1,
service_id=service["id"],
headers=[{
"name": "x-test-1",
"values": [
"a",
"b",
],
}])
package main
import (
"github.com/pulumi/pulumi-kong/sdk/v4/go/kong"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := kong.NewRoute(ctx, "route", &kong.RouteArgs{
Name: pulumi.String("MyRoute"),
Protocols: pulumi.StringArray{
pulumi.String("http"),
pulumi.String("https"),
},
Methods: pulumi.StringArray{
pulumi.String("GET"),
pulumi.String("POST"),
},
Hosts: pulumi.StringArray{
pulumi.String("example2.com"),
},
Paths: pulumi.StringArray{
pulumi.String("/test"),
},
StripPath: pulumi.Bool(false),
PreserveHost: pulumi.Bool(true),
RegexPriority: pulumi.Int(1),
ServiceId: pulumi.Any(service.Id),
Headers: kong.RouteHeaderArray{
&kong.RouteHeaderArgs{
Name: pulumi.String("x-test-1"),
Values: pulumi.StringArray{
pulumi.String("a"),
pulumi.String("b"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Kong = Pulumi.Kong;
return await Deployment.RunAsync(() =>
{
var route = new Kong.Route("route", new()
{
Name = "MyRoute",
Protocols = new[]
{
"http",
"https",
},
Methods = new[]
{
"GET",
"POST",
},
Hosts = new[]
{
"example2.com",
},
Paths = new[]
{
"/test",
},
StripPath = false,
PreserveHost = true,
RegexPriority = 1,
ServiceId = service.Id,
Headers = new[]
{
new Kong.Inputs.RouteHeaderArgs
{
Name = "x-test-1",
Values = new[]
{
"a",
"b",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.kong.Route;
import com.pulumi.kong.RouteArgs;
import com.pulumi.kong.inputs.RouteHeaderArgs;
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 route = new Route("route", RouteArgs.builder()
.name("MyRoute")
.protocols(
"http",
"https")
.methods(
"GET",
"POST")
.hosts("example2.com")
.paths("/test")
.stripPath(false)
.preserveHost(true)
.regexPriority(1)
.serviceId(service.id())
.headers(RouteHeaderArgs.builder()
.name("x-test-1")
.values(
"a",
"b")
.build())
.build());
}
}
resources:
route:
type: kong:Route
properties:
name: MyRoute
protocols:
- http
- https
methods:
- GET
- POST
hosts:
- example2.com
paths:
- /test
stripPath: false
preserveHost: true
regexPriority: 1
serviceId: ${service.id}
headers:
- name: x-test-1
values:
- a
- b
To create a tcp/tls route you set sources
and destinations
by repeating the corresponding element (source
or destination
) for each source or destination you want, for example:
import * as pulumi from "@pulumi/pulumi";
import * as kong from "@pulumi/kong";
const route = new kong.Route("route", {
protocols: ["tcp"],
stripPath: true,
preserveHost: false,
sources: [
{
ip: "192.168.1.1",
port: 80,
},
{
ip: "192.168.1.2",
},
],
destinations: [{
ip: "172.10.1.1",
port: 81,
}],
snis: ["foo.com"],
serviceId: service.id,
});
import pulumi
import pulumi_kong as kong
route = kong.Route("route",
protocols=["tcp"],
strip_path=True,
preserve_host=False,
sources=[
{
"ip": "192.168.1.1",
"port": 80,
},
{
"ip": "192.168.1.2",
},
],
destinations=[{
"ip": "172.10.1.1",
"port": 81,
}],
snis=["foo.com"],
service_id=service["id"])
package main
import (
"github.com/pulumi/pulumi-kong/sdk/v4/go/kong"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := kong.NewRoute(ctx, "route", &kong.RouteArgs{
Protocols: pulumi.StringArray{
pulumi.String("tcp"),
},
StripPath: pulumi.Bool(true),
PreserveHost: pulumi.Bool(false),
Sources: kong.RouteSourceArray{
&kong.RouteSourceArgs{
Ip: pulumi.String("192.168.1.1"),
Port: pulumi.Int(80),
},
&kong.RouteSourceArgs{
Ip: pulumi.String("192.168.1.2"),
},
},
Destinations: kong.RouteDestinationArray{
&kong.RouteDestinationArgs{
Ip: pulumi.String("172.10.1.1"),
Port: pulumi.Int(81),
},
},
Snis: pulumi.StringArray{
pulumi.String("foo.com"),
},
ServiceId: pulumi.Any(service.Id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Kong = Pulumi.Kong;
return await Deployment.RunAsync(() =>
{
var route = new Kong.Route("route", new()
{
Protocols = new[]
{
"tcp",
},
StripPath = true,
PreserveHost = false,
Sources = new[]
{
new Kong.Inputs.RouteSourceArgs
{
Ip = "192.168.1.1",
Port = 80,
},
new Kong.Inputs.RouteSourceArgs
{
Ip = "192.168.1.2",
},
},
Destinations = new[]
{
new Kong.Inputs.RouteDestinationArgs
{
Ip = "172.10.1.1",
Port = 81,
},
},
Snis = new[]
{
"foo.com",
},
ServiceId = service.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.kong.Route;
import com.pulumi.kong.RouteArgs;
import com.pulumi.kong.inputs.RouteSourceArgs;
import com.pulumi.kong.inputs.RouteDestinationArgs;
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 route = new Route("route", RouteArgs.builder()
.protocols("tcp")
.stripPath(true)
.preserveHost(false)
.sources(
RouteSourceArgs.builder()
.ip("192.168.1.1")
.port(80)
.build(),
RouteSourceArgs.builder()
.ip("192.168.1.2")
.build())
.destinations(RouteDestinationArgs.builder()
.ip("172.10.1.1")
.port(81)
.build())
.snis("foo.com")
.serviceId(service.id())
.build());
}
}
resources:
route:
type: kong:Route
properties:
protocols:
- tcp
stripPath: true
preserveHost: false
sources:
- ip: 192.168.1.1
port: 80
- ip: 192.168.1.2
destinations:
- ip: 172.10.1.1
port: 81
snis:
- foo.com
serviceId: ${service.id}
Create Route Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);
@overload
def Route(resource_name: str,
args: RouteArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Route(resource_name: str,
opts: Optional[ResourceOptions] = None,
protocols: Optional[Sequence[str]] = None,
service_id: Optional[str] = None,
preserve_host: Optional[bool] = None,
hosts: Optional[Sequence[str]] = None,
methods: Optional[Sequence[str]] = None,
name: Optional[str] = None,
path_handling: Optional[str] = None,
paths: Optional[Sequence[str]] = None,
destinations: Optional[Sequence[RouteDestinationArgs]] = None,
https_redirect_status_code: Optional[int] = None,
regex_priority: Optional[int] = None,
request_buffering: Optional[bool] = None,
response_buffering: Optional[bool] = None,
headers: Optional[Sequence[RouteHeaderArgs]] = None,
snis: Optional[Sequence[str]] = None,
sources: Optional[Sequence[RouteSourceArgs]] = None,
strip_path: Optional[bool] = None,
tags: Optional[Sequence[str]] = None)
func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)
public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)
type: kong:Route
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 RouteArgs
- 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 RouteArgs
- 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 RouteArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var routeResource = new Kong.Route("routeResource", new()
{
Protocols = new[]
{
"string",
},
ServiceId = "string",
PreserveHost = false,
Hosts = new[]
{
"string",
},
Methods = new[]
{
"string",
},
Name = "string",
PathHandling = "string",
Paths = new[]
{
"string",
},
Destinations = new[]
{
new Kong.Inputs.RouteDestinationArgs
{
Ip = "string",
Port = 0,
},
},
HttpsRedirectStatusCode = 0,
RegexPriority = 0,
RequestBuffering = false,
ResponseBuffering = false,
Headers = new[]
{
new Kong.Inputs.RouteHeaderArgs
{
Name = "string",
Values = new[]
{
"string",
},
},
},
Snis = new[]
{
"string",
},
Sources = new[]
{
new Kong.Inputs.RouteSourceArgs
{
Ip = "string",
Port = 0,
},
},
StripPath = false,
Tags = new[]
{
"string",
},
});
example, err := kong.NewRoute(ctx, "routeResource", &kong.RouteArgs{
Protocols: pulumi.StringArray{
pulumi.String("string"),
},
ServiceId: pulumi.String("string"),
PreserveHost: pulumi.Bool(false),
Hosts: pulumi.StringArray{
pulumi.String("string"),
},
Methods: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
PathHandling: pulumi.String("string"),
Paths: pulumi.StringArray{
pulumi.String("string"),
},
Destinations: kong.RouteDestinationArray{
&kong.RouteDestinationArgs{
Ip: pulumi.String("string"),
Port: pulumi.Int(0),
},
},
HttpsRedirectStatusCode: pulumi.Int(0),
RegexPriority: pulumi.Int(0),
RequestBuffering: pulumi.Bool(false),
ResponseBuffering: pulumi.Bool(false),
Headers: kong.RouteHeaderArray{
&kong.RouteHeaderArgs{
Name: pulumi.String("string"),
Values: pulumi.StringArray{
pulumi.String("string"),
},
},
},
Snis: pulumi.StringArray{
pulumi.String("string"),
},
Sources: kong.RouteSourceArray{
&kong.RouteSourceArgs{
Ip: pulumi.String("string"),
Port: pulumi.Int(0),
},
},
StripPath: pulumi.Bool(false),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var routeResource = new Route("routeResource", RouteArgs.builder()
.protocols("string")
.serviceId("string")
.preserveHost(false)
.hosts("string")
.methods("string")
.name("string")
.pathHandling("string")
.paths("string")
.destinations(RouteDestinationArgs.builder()
.ip("string")
.port(0)
.build())
.httpsRedirectStatusCode(0)
.regexPriority(0)
.requestBuffering(false)
.responseBuffering(false)
.headers(RouteHeaderArgs.builder()
.name("string")
.values("string")
.build())
.snis("string")
.sources(RouteSourceArgs.builder()
.ip("string")
.port(0)
.build())
.stripPath(false)
.tags("string")
.build());
route_resource = kong.Route("routeResource",
protocols=["string"],
service_id="string",
preserve_host=False,
hosts=["string"],
methods=["string"],
name="string",
path_handling="string",
paths=["string"],
destinations=[{
"ip": "string",
"port": 0,
}],
https_redirect_status_code=0,
regex_priority=0,
request_buffering=False,
response_buffering=False,
headers=[{
"name": "string",
"values": ["string"],
}],
snis=["string"],
sources=[{
"ip": "string",
"port": 0,
}],
strip_path=False,
tags=["string"])
const routeResource = new kong.Route("routeResource", {
protocols: ["string"],
serviceId: "string",
preserveHost: false,
hosts: ["string"],
methods: ["string"],
name: "string",
pathHandling: "string",
paths: ["string"],
destinations: [{
ip: "string",
port: 0,
}],
httpsRedirectStatusCode: 0,
regexPriority: 0,
requestBuffering: false,
responseBuffering: false,
headers: [{
name: "string",
values: ["string"],
}],
snis: ["string"],
sources: [{
ip: "string",
port: 0,
}],
stripPath: false,
tags: ["string"],
});
type: kong:Route
properties:
destinations:
- ip: string
port: 0
headers:
- name: string
values:
- string
hosts:
- string
httpsRedirectStatusCode: 0
methods:
- string
name: string
pathHandling: string
paths:
- string
preserveHost: false
protocols:
- string
regexPriority: 0
requestBuffering: false
responseBuffering: false
serviceId: string
snis:
- string
sources:
- ip: string
port: 0
stripPath: false
tags:
- string
Route Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Route resource accepts the following input properties:
- Protocols List<string>
- The list of protocols to use
- Service
Id string - Service ID to map to
- Destinations
List<Route
Destination> - A list of destination
ip
andport
- Headers
List<Route
Header> - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - Hosts List<string>
- A list of domain names that match this Route
- Https
Redirect intStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - Methods List<string>
- A list of HTTP methods that match this Route
- Name string
- The name of the route
- Path
Handling string - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- Paths List<string>
- A list of paths that match this Route
- Preserve
Host bool - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- Regex
Priority int - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- Request
Buffering bool - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- Response
Buffering bool - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- Snis List<string>
- A list of SNIs that match this Route when using stream routing.
- Sources
List<Route
Source> - A list of source
ip
andport
- Strip
Path bool - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- List<string>
- A list of strings associated with the Route for grouping and filtering.
- Protocols []string
- The list of protocols to use
- Service
Id string - Service ID to map to
- Destinations
[]Route
Destination Args - A list of destination
ip
andport
- Headers
[]Route
Header Args - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - Hosts []string
- A list of domain names that match this Route
- Https
Redirect intStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - Methods []string
- A list of HTTP methods that match this Route
- Name string
- The name of the route
- Path
Handling string - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- Paths []string
- A list of paths that match this Route
- Preserve
Host bool - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- Regex
Priority int - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- Request
Buffering bool - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- Response
Buffering bool - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- Snis []string
- A list of SNIs that match this Route when using stream routing.
- Sources
[]Route
Source Args - A list of source
ip
andport
- Strip
Path bool - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- []string
- A list of strings associated with the Route for grouping and filtering.
- protocols List<String>
- The list of protocols to use
- service
Id String - Service ID to map to
- destinations
List<Route
Destination> - A list of destination
ip
andport
- headers
List<Route
Header> - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts List<String>
- A list of domain names that match this Route
- https
Redirect IntegerStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods List<String>
- A list of HTTP methods that match this Route
- name String
- The name of the route
- path
Handling String - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths List<String>
- A list of paths that match this Route
- preserve
Host Boolean - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- regex
Priority Integer - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request
Buffering Boolean - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response
Buffering Boolean - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- snis List<String>
- A list of SNIs that match this Route when using stream routing.
- sources
List<Route
Source> - A list of source
ip
andport
- strip
Path Boolean - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- List<String>
- A list of strings associated with the Route for grouping and filtering.
- protocols string[]
- The list of protocols to use
- service
Id string - Service ID to map to
- destinations
Route
Destination[] - A list of destination
ip
andport
- headers
Route
Header[] - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts string[]
- A list of domain names that match this Route
- https
Redirect numberStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods string[]
- A list of HTTP methods that match this Route
- name string
- The name of the route
- path
Handling string - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths string[]
- A list of paths that match this Route
- preserve
Host boolean - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- regex
Priority number - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request
Buffering boolean - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response
Buffering boolean - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- snis string[]
- A list of SNIs that match this Route when using stream routing.
- sources
Route
Source[] - A list of source
ip
andport
- strip
Path boolean - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- string[]
- A list of strings associated with the Route for grouping and filtering.
- protocols Sequence[str]
- The list of protocols to use
- service_
id str - Service ID to map to
- destinations
Sequence[Route
Destination Args] - A list of destination
ip
andport
- headers
Sequence[Route
Header Args] - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts Sequence[str]
- A list of domain names that match this Route
- https_
redirect_ intstatus_ code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods Sequence[str]
- A list of HTTP methods that match this Route
- name str
- The name of the route
- path_
handling str - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths Sequence[str]
- A list of paths that match this Route
- preserve_
host bool - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- regex_
priority int - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request_
buffering bool - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response_
buffering bool - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- snis Sequence[str]
- A list of SNIs that match this Route when using stream routing.
- sources
Sequence[Route
Source Args] - A list of source
ip
andport
- strip_
path bool - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- Sequence[str]
- A list of strings associated with the Route for grouping and filtering.
- protocols List<String>
- The list of protocols to use
- service
Id String - Service ID to map to
- destinations List<Property Map>
- A list of destination
ip
andport
- headers List<Property Map>
- One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts List<String>
- A list of domain names that match this Route
- https
Redirect NumberStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods List<String>
- A list of HTTP methods that match this Route
- name String
- The name of the route
- path
Handling String - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths List<String>
- A list of paths that match this Route
- preserve
Host Boolean - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- regex
Priority Number - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request
Buffering Boolean - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response
Buffering Boolean - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- snis List<String>
- A list of SNIs that match this Route when using stream routing.
- sources List<Property Map>
- A list of source
ip
andport
- strip
Path Boolean - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- List<String>
- A list of strings associated with the Route for grouping and filtering.
Outputs
All input properties are implicitly available as output properties. Additionally, the Route resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Route Resource
Get an existing Route 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?: RouteState, opts?: CustomResourceOptions): Route
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
destinations: Optional[Sequence[RouteDestinationArgs]] = None,
headers: Optional[Sequence[RouteHeaderArgs]] = None,
hosts: Optional[Sequence[str]] = None,
https_redirect_status_code: Optional[int] = None,
methods: Optional[Sequence[str]] = None,
name: Optional[str] = None,
path_handling: Optional[str] = None,
paths: Optional[Sequence[str]] = None,
preserve_host: Optional[bool] = None,
protocols: Optional[Sequence[str]] = None,
regex_priority: Optional[int] = None,
request_buffering: Optional[bool] = None,
response_buffering: Optional[bool] = None,
service_id: Optional[str] = None,
snis: Optional[Sequence[str]] = None,
sources: Optional[Sequence[RouteSourceArgs]] = None,
strip_path: Optional[bool] = None,
tags: Optional[Sequence[str]] = None) -> Route
func GetRoute(ctx *Context, name string, id IDInput, state *RouteState, opts ...ResourceOption) (*Route, error)
public static Route Get(string name, Input<string> id, RouteState? state, CustomResourceOptions? opts = null)
public static Route get(String name, Output<String> id, RouteState 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.
- Destinations
List<Route
Destination> - A list of destination
ip
andport
- Headers
List<Route
Header> - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - Hosts List<string>
- A list of domain names that match this Route
- Https
Redirect intStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - Methods List<string>
- A list of HTTP methods that match this Route
- Name string
- The name of the route
- Path
Handling string - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- Paths List<string>
- A list of paths that match this Route
- Preserve
Host bool - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- Protocols List<string>
- The list of protocols to use
- Regex
Priority int - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- Request
Buffering bool - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- Response
Buffering bool - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- Service
Id string - Service ID to map to
- Snis List<string>
- A list of SNIs that match this Route when using stream routing.
- Sources
List<Route
Source> - A list of source
ip
andport
- Strip
Path bool - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- List<string>
- A list of strings associated with the Route for grouping and filtering.
- Destinations
[]Route
Destination Args - A list of destination
ip
andport
- Headers
[]Route
Header Args - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - Hosts []string
- A list of domain names that match this Route
- Https
Redirect intStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - Methods []string
- A list of HTTP methods that match this Route
- Name string
- The name of the route
- Path
Handling string - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- Paths []string
- A list of paths that match this Route
- Preserve
Host bool - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- Protocols []string
- The list of protocols to use
- Regex
Priority int - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- Request
Buffering bool - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- Response
Buffering bool - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- Service
Id string - Service ID to map to
- Snis []string
- A list of SNIs that match this Route when using stream routing.
- Sources
[]Route
Source Args - A list of source
ip
andport
- Strip
Path bool - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- []string
- A list of strings associated with the Route for grouping and filtering.
- destinations
List<Route
Destination> - A list of destination
ip
andport
- headers
List<Route
Header> - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts List<String>
- A list of domain names that match this Route
- https
Redirect IntegerStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods List<String>
- A list of HTTP methods that match this Route
- name String
- The name of the route
- path
Handling String - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths List<String>
- A list of paths that match this Route
- preserve
Host Boolean - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- protocols List<String>
- The list of protocols to use
- regex
Priority Integer - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request
Buffering Boolean - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response
Buffering Boolean - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- service
Id String - Service ID to map to
- snis List<String>
- A list of SNIs that match this Route when using stream routing.
- sources
List<Route
Source> - A list of source
ip
andport
- strip
Path Boolean - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- List<String>
- A list of strings associated with the Route for grouping and filtering.
- destinations
Route
Destination[] - A list of destination
ip
andport
- headers
Route
Header[] - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts string[]
- A list of domain names that match this Route
- https
Redirect numberStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods string[]
- A list of HTTP methods that match this Route
- name string
- The name of the route
- path
Handling string - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths string[]
- A list of paths that match this Route
- preserve
Host boolean - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- protocols string[]
- The list of protocols to use
- regex
Priority number - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request
Buffering boolean - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response
Buffering boolean - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- service
Id string - Service ID to map to
- snis string[]
- A list of SNIs that match this Route when using stream routing.
- sources
Route
Source[] - A list of source
ip
andport
- strip
Path boolean - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- string[]
- A list of strings associated with the Route for grouping and filtering.
- destinations
Sequence[Route
Destination Args] - A list of destination
ip
andport
- headers
Sequence[Route
Header Args] - One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts Sequence[str]
- A list of domain names that match this Route
- https_
redirect_ intstatus_ code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods Sequence[str]
- A list of HTTP methods that match this Route
- name str
- The name of the route
- path_
handling str - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths Sequence[str]
- A list of paths that match this Route
- preserve_
host bool - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- protocols Sequence[str]
- The list of protocols to use
- regex_
priority int - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request_
buffering bool - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response_
buffering bool - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- service_
id str - Service ID to map to
- snis Sequence[str]
- A list of SNIs that match this Route when using stream routing.
- sources
Sequence[Route
Source Args] - A list of source
ip
andport
- strip_
path bool - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- Sequence[str]
- A list of strings associated with the Route for grouping and filtering.
- destinations List<Property Map>
- A list of destination
ip
andport
- headers List<Property Map>
- One or more blocks of
name
to set name of header andvalues
which is a list ofstring
for the header values to match on. See above example of how to set. These headers will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. - hosts List<String>
- A list of domain names that match this Route
- https
Redirect NumberStatus Code - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to
301
,302
,307
or308
. Accepted values are:426
,301
,302
,307
,308
. Default:426
. - methods List<String>
- A list of HTTP methods that match this Route
- name String
- The name of the route
- path
Handling String - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream.
- paths List<String>
- A list of paths that match this Route
- preserve
Host Boolean - When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
- protocols List<String>
- The list of protocols to use
- regex
Priority Number - A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.
- request
Buffering Boolean - Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. Default: true.
- response
Buffering Boolean - Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. Default: true.
- service
Id String - Service ID to map to
- snis List<String>
- A list of SNIs that match this Route when using stream routing.
- sources List<Property Map>
- A list of source
ip
andport
- strip
Path Boolean - When matching a Route via one of the paths, strip the matching prefix from the upstream request URL. Default: true.
- List<String>
- A list of strings associated with the Route for grouping and filtering.
Supporting Types
RouteDestination, RouteDestinationArgs
RouteHeader, RouteHeaderArgs
RouteSource, RouteSourceArgs
Import
To import a route:
$ pulumi import kong:index/route:Route <route_identifier> <route_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Kong pulumi/pulumi-kong
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
kong
Terraform Provider.