Adds langfuse ec2 and api key to code

This commit is contained in:
2026-02-26 13:34:45 -03:00
parent 5717cdd254
commit b7c0b92fa3
14 changed files with 487 additions and 41 deletions

View File

@@ -202,13 +202,23 @@ resource "aws_iam_role_policy" "s3_policy" {
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = [
"s3:GetObject"
]
Resource = "arn:aws:s3:::upflux-doc-analyzer/*"
}]
Statement = [
{
Effect = "Allow"
Action = [
"s3:GetObject",
"s3:PutObject"
]
Resource = "arn:aws:s3:::upflux-doc-analyzer/*"
},
{
Effect = "Allow"
Action = [
"s3:DeleteObject"
]
Resource = "arn:aws:s3:::upflux-doc-analyzer/temp_textract/*"
}
]
})
}
@@ -229,6 +239,23 @@ resource "aws_iam_role_policy" "textract_policy" {
}]
})
}
resource "aws_iam_role_policy" "secrets_manager_policy" {
name = "${var.app_name}-secrets-manager-policy"
role = aws_iam_role.ecs_task_role.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = [
"secretsmanager:GetSecretValue"
]
Resource = "*"
}]
})
}
# ECS Task Definition
resource "aws_ecs_task_definition" "app" {
family = var.app_name
@@ -242,6 +269,13 @@ resource "aws_ecs_task_definition" "app" {
name = var.app_name
image = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.aws_region}.amazonaws.com/${var.ecr_repository_name}:${var.image_tag}"
environment = [
{
name = "LANGFUSE_HOST"
value = var.langfuse_host
}
]
portMappings = [{
containerPort = 8000
hostPort = 8000

View File

@@ -20,4 +20,5 @@ ecr_repository_name = "upflux-doc-analyser"
image_tag = "latest"
fargate_cpu = "256"
fargate_memory = "512"
app_count = 1
app_count = 1
langfuse_host = "http://10.0.0.12:3000"

View File

@@ -53,4 +53,9 @@ variable "app_count" {
description = "Number of tasks to run"
type = number
default = 1
}
variable "langfuse_host" {
description = "Langfuse host URL"
type = string
}