Skip to content

add iam auth to api gateway HTTP using terraform api gateway module #86

@yuvalberk

Description

@yuvalberk

Description

I want to add the built in iam Authorization type to an HTTP type api gateway
I tried adding different types of authorizations but couldn't find a way to just add the basic iam auth

module "api_gateway" {
  source = "terraform-aws-modules/apigateway-v2/aws"

  name          = "dev-http"
  description   = "My awesome HTTP API Gateway"
  protocol_type = "HTTP"

  # Routes and integrations
  integrations = {
    "POST /test" = {
      lambda_arn = "arn:aws:lambda:eu-central-1:9999999:function:sample_lambda"
      authorizer_key = "IAM"
    }
  }
  create_api_domain_name = false
  authorizers = {
    "IAM" = {
      authorizer_type  = "REQUEST"
      name             = "iam-auth"
    }
  }

  tags = {
    Name = "http-apigateway"
  }
}

this is the module code where i am trying to add the iam auth.

this code is not working and i am getting this error

│ Error: creating API Gateway v2 authorizer: BadRequestException: AuthorizerUri is a required field in an Authorizer
│
│   with module.api_gateway.aws_apigatewayv2_authorizer.this["IAM"],
│   on .terraform\modules\api_gateway\main.tf line 187, in resource "aws_apigatewayv2_authorizer" "this":
│  187: resource "aws_apigatewayv2_authorizer" "this" {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions