Skip to content

Commit 9d641a4

Browse files
feat: Add lambda as additional auth provider (#52)
1 parent 78bebdd commit 9d641a4

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

examples/complete/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ module "appsync" {
139139
app_id_client_regex = aws_cognito_user_pool_client.this.id
140140
}
141141
}
142+
143+
lambda = {
144+
authentication_type = "AWS_LAMBDA"
145+
lambda_authorizer_config = {
146+
authorizer_uri = "arn:aws:lambda:eu-west-1:835367859851:function:appsync_auth_2"
147+
}
148+
}
142149
}
143150

144151
functions = {

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ resource "aws_appsync_graphql_api" "this" {
8383
aws_region = lookup(user_pool_config.value, "aws_region", null)
8484
}
8585
}
86+
dynamic "lambda_authorizer_config" {
87+
for_each = length(keys(lookup(additional_authentication_provider.value, "lambda_authorizer_config", {}))) == 0 ? [] : [additional_authentication_provider.value.lambda_authorizer_config]
88+
89+
content {
90+
authorizer_uri = lambda_authorizer_config.value.authorizer_uri
91+
authorizer_result_ttl_in_seconds = lookup(lambda_authorizer_config.value, "authorizer_result_ttl_in_seconds", null)
92+
identity_validation_expression = lookup(lambda_authorizer_config.value, "identity_validation_expression", null)
93+
}
94+
}
8695
}
8796
}
8897

0 commit comments

Comments
 (0)