Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Cognito user pool ID in lambda integration and API Gateway con… #47

Merged
merged 3 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lambdas/inference/lambda_integration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ module "integration_cognito" {
lambda_function_name = var.lambda_function_name
api_key_required = false
authorization_type = "COGNITO_USER_POOLS"
authorizer_id = var.cognito_user_pool_arn
authorizer_id = var.cognito_user_pool_id
}
2 changes: 1 addition & 1 deletion lambdas/inference/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ variable "api_gateway_rest_api_root_resource_id" {
nullable = false
}

variable "cognito_user_pool_arn" {
variable "cognito_user_pool_id" {
type = string
nullable = false
}
10 changes: 5 additions & 5 deletions terraform/api_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ resource "aws_api_gateway_usage_plan_key" "this" {

## 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]
name = "${var.api_name}-authorizer"
rest_api_id = aws_api_gateway_rest_api.this.id
type = "COGNITO_USER_POOLS"
provider_arns = data.aws_cognito_user_pools.api_cognito.arns
}


Expand Down Expand Up @@ -110,4 +110,4 @@ resource "aws_iam_role_policy" "this" {
]
}
POLICY
}
}
3 changes: 3 additions & 0 deletions terraform/cognito_authorizer.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "aws_cognito_user_pools" "api_cognito" {
name = "estaec814cb7e6_userpool_814cb7e6-dev"
}
2 changes: 1 addition & 1 deletion terraform/modules.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module "inference" {
embedding_collection_name = local.storage_bucket_name
api_gateway_rest_api_id = aws_api_gateway_rest_api.this.id
api_gateway_rest_api_root_resource_id = aws_api_gateway_rest_api.this.root_resource_id
cognito_user_pool_arn = var.cognito_user_pool_arn
cognito_user_pool_id = data.aws_cognito_user_pools.api_cognito.id
}

module "memory" {
Expand Down
6 changes: 0 additions & 6 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ variable "api_gateway_stage_name" {
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"
}

variable "sender_email" {
type = string
nullable = false
Expand Down
Loading