Skip to content

Commit 91b909a

Browse files
committed
add valid gitlab handler fn name + alignment api gateway api
1 parent ecb9297 commit 91b909a

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

locals.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ locals {
33
single_lambda_integration = contains(["jira", "terraform"], var.integration_type) ? true : false
44
multiple_lambda_integration = contains(["gitlab", "github"], var.integration_type) ? true : false
55
api_triggered_function_arn = local.single_lambda_integration ? module.lambda_function[0].lambda_function_arn : module.frontend_lambda_function[0].lambda_function_arn
6-
frontend_lambda_handler = contains(["github"], var.integration_type) ? "index.handler" : "frontend.app"
7-
backend_lambda_handler = contains(["github"], var.integration_type) ? "index.handler" : "backend.app"
6+
frontend_lambda_handler = contains(["github", "gitlab"], var.integration_type) ? "index.handler" : "frontend.app"
7+
backend_lambda_handler = contains(["github", "gitlab"], var.integration_type) ? "index.handler" : "backend.app"
88
shared_default_secrets_names = ["Spectral_Dsn"]
99
default_secrets_names = {
1010
"github" = coalesce(var.secrets_names, concat(local.shared_default_secrets_names, ["Spectral_GithubBot_PrivateKey", "Spectral_GithubBot_WebhookSecret"])),
@@ -15,4 +15,4 @@ locals {
1515
# Merge user env vars with env vars which are not based on user input
1616
env_vars = merge(var.env_vars, { HOME = "/tmp" })
1717
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-
}
18+
}

modules/api_gateway/rest_api.tf

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,22 @@ resource "aws_api_gateway_rest_api" "gateway_rest_api" {
1111
)
1212
}
1313

14-
resource "aws_api_gateway_resource" "event_resource" {
14+
resource "aws_api_gateway_resource" "api_resource" {
1515
rest_api_id = aws_api_gateway_rest_api.gateway_rest_api.id
1616
parent_id = aws_api_gateway_rest_api.gateway_rest_api.root_resource_id
17-
path_part = "spectral_${var.integration_type}_event"
17+
path_part = "api"
18+
}
19+
20+
resource "aws_api_gateway_resource" "bot_resource" {
21+
rest_api_id = aws_api_gateway_rest_api.gateway_rest_api.id
22+
parent_id = aws_api_gateway_resource.api_resource.id
23+
path_part = var.integration_type
24+
}
25+
26+
resource "aws_api_gateway_resource" "event_resource" {
27+
rest_api_id = aws_api_gateway_rest_api.gateway_rest_api.id
28+
parent_id = aws_api_gateway_resource.bot_resource.id
29+
path_part = "event"
1830
}
1931

2032
resource "aws_api_gateway_method" "get_method" {
@@ -74,4 +86,4 @@ resource "aws_api_gateway_stage" "rest_api_stage" {
7486
var.global_tags,
7587
lookup(var.tags, "api_gateway", {}),
7688
)
77-
}
89+
}

0 commit comments

Comments
 (0)