1. Packages
  2. Cloudfoundry Provider
  3. API Docs
  4. Route
cloudfoundry 0.54.0 published on Monday, Apr 14, 2025 by cloudfoundry-community

cloudfoundry.Route

Explore with Pulumi AI

Provides a Cloud Foundry resource for managing Cloud Foundry application routes.

Example Usage

The following example creates an route for an application.

import * as pulumi from "@pulumi/pulumi";
import * as cloudfoundry from "@pulumi/cloudfoundry";

const _default = new cloudfoundry.Route("default", {
    domain: data.cloudfoundry_domain.apps.domain.id,
    space: data.cloudfoundry_space.dev.id,
    hostname: "myapp",
});
Copy
import pulumi
import pulumi_cloudfoundry as cloudfoundry

default = cloudfoundry.Route("default",
    domain=data["cloudfoundry_domain"]["apps"]["domain"]["id"],
    space=data["cloudfoundry_space"]["dev"]["id"],
    hostname="myapp")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/cloudfoundry/cloudfoundry"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudfoundry.NewRoute(ctx, "default", &cloudfoundry.RouteArgs{
			Domain:   pulumi.Any(data.Cloudfoundry_domain.Apps.Domain.Id),
			Space:    pulumi.Any(data.Cloudfoundry_space.Dev.Id),
			Hostname: pulumi.String("myapp"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudfoundry = Pulumi.Cloudfoundry;

return await Deployment.RunAsync(() => 
{
    var @default = new Cloudfoundry.Route("default", new()
    {
        Domain = data.Cloudfoundry_domain.Apps.Domain.Id,
        Space = data.Cloudfoundry_space.Dev.Id,
        Hostname = "myapp",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudfoundry.Route;
import com.pulumi.cloudfoundry.RouteArgs;
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 Route("default", RouteArgs.builder()
            .domain(data.cloudfoundry_domain().apps().domain().id())
            .space(data.cloudfoundry_space().dev().id())
            .hostname("myapp")
            .build());

    }
}
Copy
resources:
  default:
    type: cloudfoundry:Route
    properties:
      domain: ${data.cloudfoundry_domain.apps.domain.id}
      space: ${data.cloudfoundry_space.dev.id}
      hostname: myapp
Copy

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,
          domain: Optional[str] = None,
          space: Optional[str] = None,
          hostname: Optional[str] = None,
          path: Optional[str] = None,
          port: Optional[float] = None,
          route_id: Optional[str] = None,
          targets: Optional[Sequence[RouteTargetArgs]] = None)
func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)
public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)
public Route(String name, RouteArgs args)
public Route(String name, RouteArgs args, CustomResourceOptions options)
type: cloudfoundry:Route
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RouteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. RouteArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RouteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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 Cloudfoundry.Route("routeResource", new()
{
    Domain = "string",
    Space = "string",
    Hostname = "string",
    Path = "string",
    Port = 0,
    RouteId = "string",
    Targets = new[]
    {
        new Cloudfoundry.Inputs.RouteTargetArgs
        {
            App = "string",
            Port = 0,
        },
    },
});
Copy
example, err := cloudfoundry.NewRoute(ctx, "routeResource", &cloudfoundry.RouteArgs{
Domain: pulumi.String("string"),
Space: pulumi.String("string"),
Hostname: pulumi.String("string"),
Path: pulumi.String("string"),
Port: pulumi.Float64(0),
RouteId: pulumi.String("string"),
Targets: .RouteTargetArray{
&.RouteTargetArgs{
App: pulumi.String("string"),
Port: pulumi.Float64(0),
},
},
})
Copy
var routeResource = new Route("routeResource", RouteArgs.builder()
    .domain("string")
    .space("string")
    .hostname("string")
    .path("string")
    .port(0)
    .routeId("string")
    .targets(RouteTargetArgs.builder()
        .app("string")
        .port(0)
        .build())
    .build());
Copy
route_resource = cloudfoundry.Route("routeResource",
    domain="string",
    space="string",
    hostname="string",
    path="string",
    port=0,
    route_id="string",
    targets=[{
        "app": "string",
        "port": 0,
    }])
Copy
const routeResource = new cloudfoundry.Route("routeResource", {
    domain: "string",
    space: "string",
    hostname: "string",
    path: "string",
    port: 0,
    routeId: "string",
    targets: [{
        app: "string",
        port: 0,
    }],
});
Copy
type: cloudfoundry:Route
properties:
    domain: string
    hostname: string
    path: string
    port: 0
    routeId: string
    space: string
    targets:
        - app: string
          port: 0
Copy

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:

Domain This property is required. string
The ID of the domain to map the host name to. If not provided the default application domain will be used.
Space This property is required. string
The ID of the space to create the route in.
Hostname string

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

Path string

A path for a HTTP route.

The following maps the route to an application.

Port double

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

RouteId string
The GUID of the route
Targets List<RouteTarget>
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
Domain This property is required. string
The ID of the domain to map the host name to. If not provided the default application domain will be used.
Space This property is required. string
The ID of the space to create the route in.
Hostname string

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

Path string

A path for a HTTP route.

The following maps the route to an application.

Port float64

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

RouteId string
The GUID of the route
Targets []RouteTargetArgs
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain This property is required. String
The ID of the domain to map the host name to. If not provided the default application domain will be used.
space This property is required. String
The ID of the space to create the route in.
hostname String

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path String

A path for a HTTP route.

The following maps the route to an application.

port Double

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

routeId String
The GUID of the route
targets List<RouteTarget>
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain This property is required. string
The ID of the domain to map the host name to. If not provided the default application domain will be used.
space This property is required. string
The ID of the space to create the route in.
hostname string

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path string

A path for a HTTP route.

The following maps the route to an application.

port number

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

routeId string
The GUID of the route
targets RouteTarget[]
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain This property is required. str
The ID of the domain to map the host name to. If not provided the default application domain will be used.
space This property is required. str
The ID of the space to create the route in.
hostname str

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path str

A path for a HTTP route.

The following maps the route to an application.

port float

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

route_id str
The GUID of the route
targets Sequence[RouteTargetArgs]
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain This property is required. String
The ID of the domain to map the host name to. If not provided the default application domain will be used.
space This property is required. String
The ID of the space to create the route in.
hostname String

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path String

A path for a HTTP route.

The following maps the route to an application.

port Number

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

routeId String
The GUID of the route
targets List<Property Map>
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:

Outputs

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

Endpoint string
The complete endpoint with path if set for the route
Id string
The provider-assigned unique ID for this managed resource.
Endpoint string
The complete endpoint with path if set for the route
Id string
The provider-assigned unique ID for this managed resource.
endpoint String
The complete endpoint with path if set for the route
id String
The provider-assigned unique ID for this managed resource.
endpoint string
The complete endpoint with path if set for the route
id string
The provider-assigned unique ID for this managed resource.
endpoint str
The complete endpoint with path if set for the route
id str
The provider-assigned unique ID for this managed resource.
endpoint String
The complete endpoint with path if set for the route
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,
        domain: Optional[str] = None,
        endpoint: Optional[str] = None,
        hostname: Optional[str] = None,
        path: Optional[str] = None,
        port: Optional[float] = None,
        route_id: Optional[str] = None,
        space: Optional[str] = None,
        targets: Optional[Sequence[RouteTargetArgs]] = 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)
resources:  _:    type: cloudfoundry:Route    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Domain string
The ID of the domain to map the host name to. If not provided the default application domain will be used.
Endpoint string
The complete endpoint with path if set for the route
Hostname string

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

Path string

A path for a HTTP route.

The following maps the route to an application.

Port double

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

RouteId string
The GUID of the route
Space string
The ID of the space to create the route in.
Targets List<RouteTarget>
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
Domain string
The ID of the domain to map the host name to. If not provided the default application domain will be used.
Endpoint string
The complete endpoint with path if set for the route
Hostname string

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

Path string

A path for a HTTP route.

The following maps the route to an application.

Port float64

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

RouteId string
The GUID of the route
Space string
The ID of the space to create the route in.
Targets []RouteTargetArgs
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain String
The ID of the domain to map the host name to. If not provided the default application domain will be used.
endpoint String
The complete endpoint with path if set for the route
hostname String

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path String

A path for a HTTP route.

The following maps the route to an application.

port Double

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

routeId String
The GUID of the route
space String
The ID of the space to create the route in.
targets List<RouteTarget>
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain string
The ID of the domain to map the host name to. If not provided the default application domain will be used.
endpoint string
The complete endpoint with path if set for the route
hostname string

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path string

A path for a HTTP route.

The following maps the route to an application.

port number

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

routeId string
The GUID of the route
space string
The ID of the space to create the route in.
targets RouteTarget[]
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain str
The ID of the domain to map the host name to. If not provided the default application domain will be used.
endpoint str
The complete endpoint with path if set for the route
hostname str

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path str

A path for a HTTP route.

The following maps the route to an application.

port float

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

route_id str
The GUID of the route
space str
The ID of the space to create the route in.
targets Sequence[RouteTargetArgs]
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:
domain String
The ID of the domain to map the host name to. If not provided the default application domain will be used.
endpoint String
The complete endpoint with path if set for the route
hostname String

The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

path String

A path for a HTTP route.

The following maps the route to an application.

port Number

The port to associate with the route for a TCP route. Conflicts with random_port.

The following argument applies only to HTTP routes.

routeId String
The GUID of the route
space String
The ID of the space to create the route in.
targets List<Property Map>
One or more route mapping(s) that will map this route to application(s). Can be repeated multiple times to load balance route traffic among multiple applications. The target block supports:

Supporting Types

RouteTarget
, RouteTargetArgs

App This property is required. string
The ID of the application to map this route to.
Port double

A port that the application will be listening on. If this argument is not provided then the route will be associated with the application's default port.

NOTE: Route mappings can be controlled from either the cloudfoundry_routes.target or the cloudfoundry_app.routes attributes. NOTE: Resource only handles target previously created by resource (i.e. it does not destroy nor modifies target set by other resources like cloudfoundry_application).

App This property is required. string
The ID of the application to map this route to.
Port float64

A port that the application will be listening on. If this argument is not provided then the route will be associated with the application's default port.

NOTE: Route mappings can be controlled from either the cloudfoundry_routes.target or the cloudfoundry_app.routes attributes. NOTE: Resource only handles target previously created by resource (i.e. it does not destroy nor modifies target set by other resources like cloudfoundry_application).

app This property is required. String
The ID of the application to map this route to.
port Double

A port that the application will be listening on. If this argument is not provided then the route will be associated with the application's default port.

NOTE: Route mappings can be controlled from either the cloudfoundry_routes.target or the cloudfoundry_app.routes attributes. NOTE: Resource only handles target previously created by resource (i.e. it does not destroy nor modifies target set by other resources like cloudfoundry_application).

app This property is required. string
The ID of the application to map this route to.
port number

A port that the application will be listening on. If this argument is not provided then the route will be associated with the application's default port.

NOTE: Route mappings can be controlled from either the cloudfoundry_routes.target or the cloudfoundry_app.routes attributes. NOTE: Resource only handles target previously created by resource (i.e. it does not destroy nor modifies target set by other resources like cloudfoundry_application).

app This property is required. str
The ID of the application to map this route to.
port float

A port that the application will be listening on. If this argument is not provided then the route will be associated with the application's default port.

NOTE: Route mappings can be controlled from either the cloudfoundry_routes.target or the cloudfoundry_app.routes attributes. NOTE: Resource only handles target previously created by resource (i.e. it does not destroy nor modifies target set by other resources like cloudfoundry_application).

app This property is required. String
The ID of the application to map this route to.
port Number

A port that the application will be listening on. If this argument is not provided then the route will be associated with the application's default port.

NOTE: Route mappings can be controlled from either the cloudfoundry_routes.target or the cloudfoundry_app.routes attributes. NOTE: Resource only handles target previously created by resource (i.e. it does not destroy nor modifies target set by other resources like cloudfoundry_application).

Import

The current Route can be imported using the route, e.g.

bash

$ pulumi import cloudfoundry:index/route:Route default a-guid
Copy

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

Package Details

Repository
cloudfoundry cloudfoundry-community/terraform-provider-cloudfoundry
License
Notes
This Pulumi package is based on the cloudfoundry Terraform Provider.