-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda_helper_functions.tf
More file actions
57 lines (49 loc) · 1.5 KB
/
lambda_helper_functions.tf
File metadata and controls
57 lines (49 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
resource "aws_security_group" "deployment_automation" {
name = "${var.app_name}-deployment_automation-${var.environment}"
vpc_id = var.vpc_id
description = "lambda VPC security group"
ingress {
from_port = 0
to_port = 0
protocol = "-1"
self = true
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
data "archive_file" "lambda_helper_functions_archive" {
type = "zip"
output_path = "${path.module}/lambda-python/helper-functions.zip"
source_file = "${path.module}/lambda-python/helper-functions/function.py"
}
resource "aws_lambda_function" "deployment_automation" {
function_name = "${var.app_name}-${var.environment}-deployment-automation"
handler = "function.deployment_automation"
filename = "${path.module}/lambda-python/helper-functions.zip"
memory_size = 128
role = aws_iam_role.deploy_automation.arn
runtime = "python3.11"
source_code_hash = data.archive_file.lambda_helper_functions_archive.output_base64sha256
timeout = 300
layers = []
vpc_config {
subnet_ids = var.lambda_subnet_ids
security_group_ids = [
aws_security_group.deployment_automation.id
]
}
environment {
variables = {
TARGET_SERVICE = var.ecs_service_id
DISTRIBUTION_ID = var.cloudfront_distribution_id
HOOK_URL = var.slack_hook_url
SLACK_CHANNEL = var.slack_channel
ENV_NAME = var.environment
APP_NAME = var.app_name
}
}
}