Skip to content

Commit

Permalink
Merge pull request #32 from FloRul/feature/api-auth
Browse files Browse the repository at this point in the history
Add API Gateway authorizer and Cognito user pool ARN
  • Loading branch information
FloRul authored Feb 20, 2024
2 parents 2dce5fd + 710bd2c commit fab80a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions terraform/api_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ resource "aws_api_gateway_usage_plan_key" "this" {
usage_plan_id = aws_api_gateway_usage_plan.this.id
}

## Auth and Authorizer
resource "aws_api_gateway_authorizer" "this" {
name = "${var.api_name}-authorizer"
rest_api_id = aws_api_gateway_rest_api.this.id
type = "COGNITO_USER_POOLS"
provider_arns = [var.cognito_user_pool_arn]
}


## Logging

resource "aws_api_gateway_account" "this" {
cloudwatch_role_arn = aws_iam_role.this.arn
}
Expand Down
6 changes: 6 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ variable "api_gateway_stage_name" {
nullable = false
type = string
}

variable "cognito_user_pool_arn" {
nullable = false
type = string
default = "arn:aws:cognito-idp:us-east-1:446872271111:userpool/us-east-1_N0uQPJkjd"
}

0 comments on commit fab80a5

Please sign in to comment.