Resource: aws_apigatewayv2_authorizer

Manages an Amazon API Gateway Version 2 authorizer. More information can be found in the Amazon API Gateway Developer Guide.

Example Usage

Basic WebSocket API

resource "aws_apigatewayv2_authorizer" "example" {
  api_id           = aws_apigatewayv2_api.example.id
  authorizer_type  = "REQUEST"
  authorizer_uri   = aws_lambda_function.example.invoke_arn
  identity_sources = ["route.request.header.Auth"]
  name             = "example-authorizer"
}

Basic HTTP API

resource "aws_apigatewayv2_authorizer" "example" {
  api_id                            = aws_apigatewayv2_api.example.id
  authorizer_type                   = "REQUEST"
  authorizer_uri                    = aws_lambda_function.example.invoke_arn
  identity_sources                  = ["$request.header.Authorization"]
  name                              = "example-authorizer"
  authorizer_payload_format_version = "2.0"
}

Argument Reference

This resource supports the following arguments:

The jwt_configuration object supports the following:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import aws_apigatewayv2_authorizer using the API identifier and authorizer identifier. For example:

import {
  to = aws_apigatewayv2_authorizer.example
  id = "aabbccddee/1122334"
}

Using terraform import, import aws_apigatewayv2_authorizer using the API identifier and authorizer identifier. For example:

% terraform import aws_apigatewayv2_authorizer.example aabbccddee/1122334