Skip to content

resource_route

ArthurHlt edited this page Aug 31, 2020 · 3 revisions

cloudfoundry_route

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

Example Usage

The following example creates an route for an application.

resource "cloudfoundry_route" "default" {
    domain = data.cloudfoundry_domain.apps.domain.id
    space = data.cloudfoundry_space.dev.id
    hostname = "myapp"
}

Argument Reference

The following arguments are supported:

  • domain - (Required, String) The ID of the domain to map the host name to. If not provided the default application domain will be used.
  • space - (Required, String) The ID of the space to create the route in.
  • hostname - (Required, Optional) The application's host name. This is required for shared domains.

The following arguments apply only to TCP routes.

  • port - (Optional, Int) The port to associate with the route for a TCP route. Conflicts with random_port.
  • random_port - (Optional, Bool) Set to 'true' to create a random port. Conflicts with port and defaults to false.

The following argument applies only to HTTP routes.

  • path - (Optional) A path for a HTTP route.

The following maps the route to an application.

  • target - (Optional, Set) 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:
    • app - (Required, String) The ID of the application to map this route to.
    • port - (Optional, Int) 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).

Attributes Reference

The following attributes are exported along with any defaults for the inputs attributes.

  • id - The GUID of the route
  • endpoint - The complete endpoint with path if set for the route

Import

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

$ terraform import cloudfoundry_route.default a-guid
Clone this wiki locally