Skip to content

Commit

Permalink
Merge pull request #17500 from ewbankkit/d-aws_apigatewayv2_route-bet…
Browse files Browse the repository at this point in the history
…ter-descriptions

r/aws_apigatewayv2_route: Better documentation for 'authorization_type' and 'target' attributes
  • Loading branch information
breathingdust authored Feb 10, 2021
2 parents 4622f57 + 1f37e9e commit 4a4ced5
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions website/docs/r/apigatewayv2_route.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,67 @@ description: |-
# Resource: aws_apigatewayv2_route

Manages an Amazon API Gateway Version 2 route.
More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).
More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs.

## Example Usage

### Basic

```hcl
resource "aws_apigatewayv2_api" "example" {
name = "example-websocket-api"
protocol_type = "WEBSOCKET"
route_selection_expression = "$request.body.action"
}
resource "aws_apigatewayv2_route" "example" {
api_id = aws_apigatewayv2_api.example.id
route_key = "$default"
}
```

### HTTP Proxy Integration

```hcl
resource "aws_apigatewayv2_api" "example" {
name = "example-http-api"
protocol_type = "HTTP"
}
resource "aws_apigatewayv2_integration" "example" {
api_id = aws_apigatewayv2_api.example.id
integration_type = "HTTP_PROXY"
integration_method = "ANY"
integration_uri = "https://example.com/{proxy}"
}
resource "aws_apigatewayv2_route" "example" {
api_id = aws_apigatewayv2_api.example.id
route_key = "ANY /example/{proxy+}"
target = "integrations/${aws_apigatewayv2_integration.example.id}"
}
```

## Argument Reference

The following arguments are supported:

* `api_id` - (Required) The API identifier.
* `route_key` - (Required) The route key for the route. For HTTP APIs, the route key can be either `$default`, or a combination of an HTTP method and resource path, for example, `GET /pets`.
* `api_key_required` - (Optional) Boolean whether an API key is required for the route. Defaults to `false`.
* `api_key_required` - (Optional) Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs.
* `authorization_scopes` - (Optional) The authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
* `authorization_type` - (Optional) The authorization type for the route.
For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.
For HTTP APIs, valid values are `NONE` for open access, or `JWT` for using JSON Web Tokens.
For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.
Defaults to `NONE`.
* `authorizer_id` - (Optional) The identifier of the [`aws_apigatewayv2_authorizer`](/docs/providers/aws/r/apigatewayv2_authorizer.html) resource to be associated with this route, if the authorizationType is `CUSTOM`.
* `model_selection_expression` - (Optional) The [model selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-model-selection-expressions) for the route.
* `authorizer_id` - (Optional) The identifier of the [`aws_apigatewayv2_authorizer`](apigatewayv2_authorizer.html) resource to be associated with this route.
* `model_selection_expression` - (Optional) The [model selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-model-selection-expressions) for the route. Supported only for WebSocket APIs.
* `operation_name` - (Optional) The operation name for the route. Must be between 1 and 64 characters in length.
* `request_models` - (Optional) The request models for the route.
* `route_response_selection_expression` - (Optional) The [route response selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-response-selection-expressions) for the route.
* `target` - (Optional) The target for the route. Must be between 1 and 128 characters in length.
* `request_models` - (Optional) The request models for the route. Supported only for WebSocket APIs.
* `route_response_selection_expression` - (Optional) The [route response selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-response-selection-expressions) for the route. Supported only for WebSocket APIs.
* `target` - (Optional) The target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an [`aws_apigatewayv2_integration`](apigatewayv2_integration.html) resource.

## Attributes Reference

Expand Down

0 comments on commit 4a4ced5

Please sign in to comment.