Provides an AWS App Mesh gateway route resource.
resource "aws_appmesh_gateway_route" "example" {
name = "example-gateway-route"
mesh_name = "example-service-mesh"
virtual_gateway_name = aws_appmesh_virtual_gateway.example.name
spec {
http_route {
action {
target {
virtual_service {
virtual_service_name = aws_appmesh_virtual_service.example.name
}
}
}
match {
prefix = "/"
}
}
}
tags = {
Environment = "test"
}
}
This resource supports the following arguments:
name
- (Required) Name to use for the gateway route. Must be between 1 and 255 characters in length.mesh_name
- (Required) Name of the service mesh in which to create the gateway route. Must be between 1 and 255 characters in length.virtual_gateway_name
- (Required) Name of the virtual gateway to associate the gateway route with. Must be between 1 and 255 characters in length.mesh_owner
- (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 default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.The spec
object supports the following:
grpc_route
- (Optional) Specification of a gRPC gateway route.http_route
- (Optional) Specification of an HTTP gateway route.http2_route
- (Optional) Specification of an HTTP/2 gateway route.priority
- (Optional) Priority for the gateway route, between 0
and 1000
.The grpc_route
, http_route
and http2_route
objects supports the following:
action
- (Required) Action to take if a match is determined.match
- (Required) Criteria for determining a request match.The grpc_route
, http_route
and http2_route
'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.virtual_service
- (Required) Virtual service gateway route target.The virtual_service
object supports the following:
virtual_service_name
- (Required) Name of the virtual service that traffic is routed to. Must be between 1 and 255 characters in length.The http_route
and http2_route
'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.path
- (Optional) Exact path to rewrite.prefix
- (Optional) Specified beginning characters to rewrite.The hostname
object supports the following:
default_target_hostname
- (Required) Default target host name to write to. Valid values: ENABLED
, DISABLED
.The path
object supports the following:
exact
- (Required) Value used to replace matched path.The prefix
object supports the following:
default_prefix
- (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 grpc_route
's match
object supports the following:
service_name
- (Required) Fully qualified domain name for the service to match from the request.port
- (Optional) The port number to match from the request.The http_route
and http2_route
'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.query_parameter
- (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 query_parameter
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 query_parameter
's match
object supports the following:
exact
- (Optional) The exact query parameter to match on.This resource exports the following attributes in addition to the arguments above:
id
- ID of the gateway route.arn
- ARN of the gateway route.created_date
- Creation date of the gateway route.last_updated_date
- Last update date of the gateway route.resource_owner
- Resource owner's AWS account ID.tags_all
- Map of tags assigned to the resource, including those inherited from the provider default_tags
configuration block.In Terraform v1.5.0 and later, use an import
block to import App Mesh gateway routes using mesh_name
and virtual_gateway_name
together with the gateway route's name
. For example:
import {
to = aws_appmesh_gateway_route.example
id = "mesh/gw1/example-gateway-route"
}
Using terraform import
, import App Mesh gateway routes using mesh_name
and virtual_gateway_name
together with the gateway route's name
. For example:
% terraform import aws_appmesh_gateway_route.example mesh/gw1/example-gateway-route