Skip to content

Terraform module that creates an API Gateway using OpenAPI YAML file with an optional authorizer

Notifications You must be signed in to change notification settings

neilharia7/terraform-aws-openapi-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-openapi-gateway

Terraform module that creates an API Gateway using OpenAPI YAML file with an optional authorizer

Usage

data "github_repository_file" "workspace_open_api_file" {
  repository = "<repository name>"
  branch     = "<branch name>"
  file       = "<file path to your openapi.yaml>"
}

locals {
  open_api_file = data.github_repository_file.workspace_open_api_file.content
  update_region = replace(local.open_api_file, "$${AWS::Region}", var.region)
  cleanup       = replace(local.update_region, "Fn::Sub:", "")
  update_lambda = replace(local.cleanup, "$${Lambda.Arn}", aws_lambda_function.pet_function.function_arn)  # replace with your function arn
  final         = replace(local.update_lambda, "$${CognitoLambda.Arn}", aws_lambda_function.cognito_function.function_arn)  # replace with your cognito function arn
}

module "openapi_gateway" {
  source                       = "git::[email protected]:neilharia7/terraform-aws-openapi-gateway"
  name                         = "api-gw"
  enable_authorizer            = true
  authorizer_function_name     = aws_lambda_function.cognito_function.function_name  # replace with your cognito function arn
  lambda_handler_function_name = aws_lambda_function.pet_function.function_name  # replace with your function name
  triggers                     = {
    redeployment = local.final
  }
  types = ["REGIONAL"]
  body  = local.final
}

Requirements

Name Version
terraform >= 0.15.0
aws >= 3.69.0

Providers

Name Version
aws >= 3.69.0

About

Terraform module that creates an API Gateway using OpenAPI YAML file with an optional authorizer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages