Skip to content

Commit

Permalink
add valid gitlab handler fn name + alignment api gateway api
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad committed Aug 28, 2024
1 parent ecb9297 commit 91b909a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
6 changes: 3 additions & 3 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ locals {
single_lambda_integration = contains(["jira", "terraform"], var.integration_type) ? true : false
multiple_lambda_integration = contains(["gitlab", "github"], var.integration_type) ? true : false
api_triggered_function_arn = local.single_lambda_integration ? module.lambda_function[0].lambda_function_arn : module.frontend_lambda_function[0].lambda_function_arn
frontend_lambda_handler = contains(["github"], var.integration_type) ? "index.handler" : "frontend.app"
backend_lambda_handler = contains(["github"], var.integration_type) ? "index.handler" : "backend.app"
frontend_lambda_handler = contains(["github", "gitlab"], var.integration_type) ? "index.handler" : "frontend.app"
backend_lambda_handler = contains(["github", "gitlab"], var.integration_type) ? "index.handler" : "backend.app"
shared_default_secrets_names = ["Spectral_Dsn"]
default_secrets_names = {
"github" = coalesce(var.secrets_names, concat(local.shared_default_secrets_names, ["Spectral_GithubBot_PrivateKey", "Spectral_GithubBot_WebhookSecret"])),
Expand All @@ -15,4 +15,4 @@ locals {
# Merge user env vars with env vars which are not based on user input
env_vars = merge(var.env_vars, { HOME = "/tmp" })
blacklist_file_arn = contains(keys(var.env_vars), "S3_BLACK_LIST_OBJECT_KEY") && contains(keys(var.env_vars), "S3_BLACK_LIST_BUCKET_NAME") ? "arn:aws:s3:::${var.env_vars.S3_BLACK_LIST_BUCKET_NAME}/${var.env_vars.S3_BLACK_LIST_OBJECT_KEY}" : null
}
}
18 changes: 15 additions & 3 deletions modules/api_gateway/rest_api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,22 @@ resource "aws_api_gateway_rest_api" "gateway_rest_api" {
)
}

resource "aws_api_gateway_resource" "event_resource" {
resource "aws_api_gateway_resource" "api_resource" {
rest_api_id = aws_api_gateway_rest_api.gateway_rest_api.id
parent_id = aws_api_gateway_rest_api.gateway_rest_api.root_resource_id
path_part = "spectral_${var.integration_type}_event"
path_part = "api"
}

resource "aws_api_gateway_resource" "bot_resource" {
rest_api_id = aws_api_gateway_rest_api.gateway_rest_api.id
parent_id = aws_api_gateway_resource.api_resource.id
path_part = var.integration_type
}

resource "aws_api_gateway_resource" "event_resource" {
rest_api_id = aws_api_gateway_rest_api.gateway_rest_api.id
parent_id = aws_api_gateway_resource.bot_resource.id
path_part = "event"
}

resource "aws_api_gateway_method" "get_method" {
Expand Down Expand Up @@ -74,4 +86,4 @@ resource "aws_api_gateway_stage" "rest_api_stage" {
var.global_tags,
lookup(var.tags, "api_gateway", {}),
)
}
}

0 comments on commit 91b909a

Please sign in to comment.