Skip to content

Resource: awsAppmeshGatewayRoute

Provides an AWS App Mesh gateway route resource.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.appmeshGatewayRoute.AppmeshGatewayRoute(this, "example", {
  meshName: "example-service-mesh",
  name: "example-gateway-route",
  spec: {
    httpRoute: {
      action: {
        target: {
          virtualService: {
            virtualServiceName: "${aws_appmesh_virtual_service.example.name}",
          },
        },
      },
      match: {
        prefix: "/",
      },
    },
  },
  tags: {
    Environment: "test",
  },
  virtualGatewayName: "${aws_appmesh_virtual_gateway.example.name}",
});

Argument Reference

The following arguments are supported:

  • name - (Required) Name to use for the gateway route. Must be between 1 and 255 characters in length.
  • meshName - (Required) Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.
  • virtualGatewayName - (Required) Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.
  • meshOwner - (Optional) AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to.
  • spec - (Required) Gateway route specification to apply.
  • tags - (Optional) Map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

The spec object supports the following:

  • grpcRoute - (Optional) Specification of a gRPC gateway route.
  • httpRoute - (Optional) Specification of an HTTP gateway route.
  • http2Route - (Optional) Specification of an HTTP/2 gateway route.
  • priority - (Optional) Priority for the gateway route, between 0 and 1000.

The grpcRoute, httpRoute and http2Route objects supports the following:

  • action - (Required) Action to take if a match is determined.
  • match - (Required) Criteria for determining a request match.

The grpcRoute, httpRoute and http2Route's action object supports the following:

  • target - (Required) Target that traffic is routed to when a request matches the gateway route.

The target object supports the following:

  • port - (Optional) The port number that corresponds to the target for Virtual Service provider port. This is required when the provider (router or node) of the Virtual Service has multiple listeners.
  • virtualService - (Required) Virtual service gateway route target.

The virtualService object supports the following:

  • virtualServiceName - (Required) Name of the virtual service that traffic is routed to. Must be between 1 and 255 characters in length.

The httpRoute and http2Route's action object additionally supports the following:

  • rewrite - (Optional) Gateway route action to rewrite.

The rewrite object supports the following:

  • hostname - (Optional) Host name to rewrite.
  • prefix - (Optional) Specified beginning characters to rewrite.

The hostname object supports the following:

  • defaultTargetHostname - (Required) Default target host name to write to. Valid values: enabled, disabled.

The prefix object supports the following:

  • defaultPrefix - (Optional) Default prefix used to replace the incoming route prefix when rewritten. Valid values: enabled, disabled.
  • value - (Optional) Value used to replace the incoming route prefix when rewritten.

The grpcRoute's match object supports the following:

  • serviceName - (Required) Fully qualified domain name for the service to match from the request.
  • port - (Optional) The port number to match from the request.

The httpRoute and http2Route's match object supports the following:

  • header - (Optional) Client request headers to match on.
  • hostname - (Optional) Host name to match on.
  • path - (Optional) Client request path to match on.
  • port - (Optional) The port number to match from the request.
  • prefix - (Optional) Path to match requests with. This parameter must always start with /, which by itself matches all requests to the virtual service name.
  • queryParameter - (Optional) Client request query parameters to match on.

The header object supports the following:

  • name - (Required) Name for the HTTP header in the client request that will be matched on.
  • invert - (Optional) If true, the match is on the opposite of the match method and value. Default is false.
  • match - (Optional) Method and value to match the header value sent with a request. Specify one match method.

The header's match object supports the following:

  • exact - (Optional) Header value sent by the client must match the specified value exactly.
  • prefix - (Optional) Header value sent by the client must begin with the specified characters.
  • port- (Optional) The port number to match from the request.
  • range- (Optional) Object that specifies the range of numbers that the header value sent by the client must be included in.
  • regex - (Optional) Header value sent by the client must include the specified characters.
  • suffix - (Optional) Header value sent by the client must end with the specified characters.

The range object supports the following:

  • end - (Required) End of the range.
  • start - (Requited) Start of the range.

The hostname object supports the following:

  • exact - (Optional) Exact host name to match on.
  • suffix - (Optional) Specified ending characters of the host name to match on.

The path object supports the following:

  • exact - (Optional) The exact path to match on.
  • regex - (Optional) The regex used to match the path.

The queryParameter object supports the following:

  • name - (Required) Name for the query parameter that will be matched on.
  • match - (Optional) The query parameter to match on.

The queryParameter's match object supports the following:

  • exact - (Optional) The exact query parameter to match on.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - ID of the gateway route.
  • arn - ARN of the gateway route.
  • createdDate - Creation date of the gateway route.
  • lastUpdatedDate - Last update date of the gateway route.
  • resourceOwner - Resource owner's AWS account ID.
  • tagsAll - Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

App Mesh gateway routes can be imported using meshName and virtualGatewayName together with the gateway route's name, e.g.,

$ terraform import aws_appmesh_gateway_route.example mesh/gw1/example-gateway-route