API Gateway Route

Creates and manages IonosCloud API Gateway Route objects.

Manages an API Gateway Route on IonosCloud.

Example Usage

This resource will create an operational API Gateway Route. After this section completes, the provisioner can be called.

resource "ionoscloud_apigateway" "example" {
  name              = "example-gateway"
  metrics           = true

  custom_domains {
    name           = "example.com"
    certificate_id = "00000000-0000-0000-0000-000000000000"
  }

  custom_domains {
    name           = "example.org"
    certificate_id = "00000000-0000-0000-0000-000000000000"
  }
}

resource "ionoscloud_apigateway_route" "apigateway_route" {
  name = "apigateway-route"
  type = "http"
  paths = [
    "/foo/*",
    "/bar"
  ]
  methods = [
    "GET",
    "POST"
  ]
  websocket = false
  upstreams {
    scheme       = "http"
    loadbalancer = "roundrobin"
    host         = "example.com"
    port         = 80
    weight       = 100
  }
  gateway_id = ionoscloud_apigateway.example.id
}

Argument reference

  • id - (Computed)[string] The ID of the API Gateway Route.

  • name - (Required)[string] Name of the API Gateway Route. Only alphanumeric characters are allowed.

  • gateway_id - (Required)[string] The ID of the API Gateway that the route belongs to.

  • type - (Optional)[string] This field specifies the protocol used by the ingress to route traffic to the backend service. Default value: http.

  • paths - (Required)[list] The paths that the route should match. Minimum items: 1.

  • methods - (Required)[list] The HTTP methods that the route should match. Minimum items: 1. Possible values: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, CONNECT, TRACE.

  • websocket - (Optional)[bool] To enable websocket support. Default value: false.

  • upstreams - (Required) Upstreams information of the API Gateway Route. Minimum items: 1.

    • scheme - (Optional)[string] The target URL of the upstream. Default value: http.

    • host - (Required)[string] The host of the upstream.

    • port - (Optional)[int] The port of the upstream. Default value: 80.

    • loadbalancer - (Optional)[string] The load balancer algorithm. Default value: roundrobin.

    • weight - (Optional)[int] Weight with which to split traffic to the upstream. Default value: 100.

Import

API Gateway route can be imported using the apigateway route id:

terraform import ionoscloud_apigateway_route.myroute {apigateway uuid}:{apigateway route uuid}

Last updated