Skip to content

azurermSpringCloudGatewayRouteConfig

Manages a Spring Cloud Gateway Route Config.

-> NOTE: This resource is applicable only for Spring Cloud Service with enterprise tier.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
  features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example",
  }
);
const azurermSpringCloudServiceExample =
  new azurerm.springCloudService.SpringCloudService(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "E0",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSpringCloudServiceExample.overrideLogicalId("example");
const azurermSpringCloudAppExample = new azurerm.springCloudApp.SpringCloudApp(
  this,
  "example_3",
  {
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
    service_name: azurermSpringCloudServiceExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSpringCloudAppExample.overrideLogicalId("example");
const azurermSpringCloudGatewayExample =
  new azurerm.springCloudGateway.SpringCloudGateway(this, "example_4", {
    name: "default",
    spring_cloud_service_id: azurermSpringCloudServiceExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSpringCloudGatewayExample.overrideLogicalId("example");
const azurermSpringCloudGatewayRouteConfigExample =
  new azurerm.springCloudGatewayRouteConfig.SpringCloudGatewayRouteConfig(
    this,
    "example_5",
    {
      name: "example",
      protocol: "HTTPS",
      route: [
        {
          classification_tags: ["tag1", "tag2"],
          description: "example description",
          filters: ["StripPrefix=2", "RateLimit=1,1s"],
          order: 1,
          predicates: ["Path=/api5/customer/**"],
          sso_validation_enabled: true,
          title: "myApp route config",
          token_relay: true,
          uri: "https://www.example.com",
        },
      ],
      spring_cloud_app_id: azurermSpringCloudAppExample.id,
      spring_cloud_gateway_id: azurermSpringCloudGatewayExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSpringCloudGatewayRouteConfigExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Spring Cloud Gateway Route Config. Changing this forces a new Spring Cloud Gateway Route Config to be created.

  • springCloudGatewayId - (Required) The ID of the Spring Cloud Gateway. Changing this forces a new Spring Cloud Gateway Route Config to be created.

  • filters - (Optional) Specifies a list of filters which are used to modify the request before sending it to the target endpoint, or the received response in app level.

  • predicates - (Optional) Specifies a list of conditions to evaluate a route for each request in app level. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request.

  • ssoValidationEnabled - (Optional) Should the sso validation be enabled in app level?


  • route - (Optional) One or more route blocks as defined below.

  • openApi - (Optional) One or more openApi blocks as defined below.

  • protocol - (Optional) Specifies the protocol of routed Spring Cloud App. Allowed values are http and https. Defaults to http.

\~> Note: You likely want to use https in a production environment, since http offers no encryption.

  • springCloudAppId - (Optional) The ID of the Spring Cloud App.

A route block supports the following:

  • order - (Required) Specifies the route processing order.

  • description - (Optional) Specifies the description which will be applied to methods in the generated OpenAPI documentation.

  • filters - (Optional) Specifies a list of filters which are used to modify the request before sending it to the target endpoint, or the received response.

  • predicates - (Optional) Specifies a list of conditions to evaluate a route for each request. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request.

  • ssoValidationEnabled - (Optional) Should the sso validation be enabled?

  • classificationTags - (Optional) Specifies the classification tags which will be applied to methods in the generated OpenAPI documentation.

  • title - (Optional) Specifies the title which will be applied to methods in the generated OpenAPI documentation.

  • tokenRelay - (Optional) Should pass currently-authenticated user's identity token to application service?

  • uri - (Optional) Specifies the full uri which will override appName.


A openApi block supports the following:

  • uri - (Optional) The URI of OpenAPI specification.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Spring Cloud Gateway Route Config.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Spring Cloud Gateway Route Config.
  • read - (Defaults to 5 minutes) Used when retrieving the Spring Cloud Gateway Route Config.
  • update - (Defaults to 30 minutes) Used when updating the Spring Cloud Gateway Route Config.
  • delete - (Defaults to 30 minutes) Used when deleting the Spring Cloud Gateway Route Config.

Import

Spring Cloud Gateway Route Configs can be imported using the resourceId, e.g.

terraform import azurerm_spring_cloud_gateway_route_config.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/gateways/gateway1/routeConfigs/routeConfig1