Drop Fusion Fargate service (SaaS); host Presidio detector only
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Hosting for the two long-running containers: Fusion (the gateway) and the
|
# Hosting for the Presidio detector only. Fusion is a shared SaaS instance and is
|
||||||
# Presidio detector. Kept intentionally simple for a demo: default VPC, public
|
# NOT deployed here. Because Fusion SaaS calls the detector over the internet, the
|
||||||
# subnets, Fargate. For a first pass you can also run both containers locally
|
# analyzer port is public in this demo (lock it down / add auth for anything real;
|
||||||
# and skip this file entirely (see README "Lightweight path").
|
# better: fold detection behind the /tokenize endpoint so only that is public --
|
||||||
|
# see CLAUDE.md task T3).
|
||||||
#
|
#
|
||||||
# NOTE: var.fusion_image_uri and var.presidio_image_uri must be set first
|
# For a laptop-only rehearsal you can skip this file and run Presidio via docker.
|
||||||
# (scripts/deploy.sh builds+pushes Presidio; you supply the Axway image).
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
data "aws_vpc" "default" { default = true }
|
data "aws_vpc" "default" { default = true }
|
||||||
@@ -27,18 +27,11 @@ resource "aws_security_group" "svc" {
|
|||||||
description = "Demo services SG"
|
description = "Demo services SG"
|
||||||
vpc_id = data.aws_vpc.default.id
|
vpc_id = data.aws_vpc.default.id
|
||||||
ingress {
|
ingress {
|
||||||
description = "Fusion gateway"
|
description = "Presidio analyzer (public for SaaS Fusion demo - restrict for real use)"
|
||||||
from_port = 8080
|
|
||||||
to_port = 8080
|
|
||||||
protocol = "tcp"
|
|
||||||
cidr_blocks = ["0.0.0.0/0"] # DEMO ONLY - lock down for anything real
|
|
||||||
}
|
|
||||||
ingress {
|
|
||||||
description = "Presidio analyzer"
|
|
||||||
from_port = 5001
|
from_port = 5001
|
||||||
to_port = 5001
|
to_port = 5001
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
self = true
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
}
|
}
|
||||||
egress {
|
egress {
|
||||||
from_port = 0
|
from_port = 0
|
||||||
@@ -66,61 +59,26 @@ resource "aws_iam_role_policy_attachment" "ecs_exec" {
|
|||||||
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
|
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Task role for Fusion: it needs to invoke Bedrock/AgentCore and read/write the vault.
|
resource "aws_ecs_task_definition" "presidio" {
|
||||||
resource "aws_iam_role" "fusion_task" {
|
family = "${local.name}-presidio"
|
||||||
name = "${local.name}-fusion-task"
|
|
||||||
assume_role_policy = jsonencode({
|
|
||||||
Version = "2012-10-17"
|
|
||||||
Statement = [{
|
|
||||||
Effect = "Allow"
|
|
||||||
Principal = { Service = "ecs-tasks.amazonaws.com" }
|
|
||||||
Action = "sts:AssumeRole"
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_iam_role_policy" "fusion_task" {
|
|
||||||
name = "${local.name}-fusion-task-policy"
|
|
||||||
role = aws_iam_role.fusion_task.id
|
|
||||||
policy = jsonencode({
|
|
||||||
Version = "2012-10-17"
|
|
||||||
Statement = [
|
|
||||||
{ Effect = "Allow", Action = ["dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:Query"], Resource = [aws_dynamodb_table.vault.arn] },
|
|
||||||
{ Effect = "Allow", Action = ["bedrock:InvokeModel", "bedrock-agentcore:*"], Resource = "*" }
|
|
||||||
]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
locals {
|
|
||||||
services = {
|
|
||||||
fusion = { image = var.fusion_image_uri, port = 8080, task_role = aws_iam_role.fusion_task.arn, tag = local.onprem_tag }
|
|
||||||
presidio = { image = var.presidio_image_uri, port = 5001, task_role = aws_iam_role.ecs_exec.arn, tag = local.onprem_tag }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_ecs_task_definition" "svc" {
|
|
||||||
for_each = local.services
|
|
||||||
family = "${local.name}-${each.key}"
|
|
||||||
requires_compatibilities = ["FARGATE"]
|
requires_compatibilities = ["FARGATE"]
|
||||||
network_mode = "awsvpc"
|
network_mode = "awsvpc"
|
||||||
cpu = 512
|
cpu = 512
|
||||||
memory = 1024
|
memory = 1024
|
||||||
execution_role_arn = aws_iam_role.ecs_exec.arn
|
execution_role_arn = aws_iam_role.ecs_exec.arn
|
||||||
task_role_arn = each.value.task_role
|
|
||||||
container_definitions = jsonencode([{
|
container_definitions = jsonencode([{
|
||||||
name = each.key
|
name = "presidio"
|
||||||
image = each.value.image
|
image = var.presidio_image_uri
|
||||||
essential = true
|
essential = true
|
||||||
portMappings = [{ containerPort = each.value.port }]
|
portMappings = [{ containerPort = 5001 }]
|
||||||
}])
|
}])
|
||||||
tags = each.value.tag
|
tags = local.onprem_tag
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_ecs_service" "svc" {
|
resource "aws_ecs_service" "presidio" {
|
||||||
for_each = local.services
|
name = "${local.name}-presidio"
|
||||||
name = "${local.name}-${each.key}"
|
|
||||||
cluster = aws_ecs_cluster.this.id
|
cluster = aws_ecs_cluster.this.id
|
||||||
task_definition = aws_ecs_task_definition.svc[each.key].arn
|
task_definition = aws_ecs_task_definition.presidio.arn
|
||||||
desired_count = 1
|
desired_count = 1
|
||||||
launch_type = "FARGATE"
|
launch_type = "FARGATE"
|
||||||
network_configuration {
|
network_configuration {
|
||||||
@@ -128,5 +86,5 @@ resource "aws_ecs_service" "svc" {
|
|||||||
security_groups = [aws_security_group.svc.id]
|
security_groups = [aws_security_group.svc.id]
|
||||||
assign_public_ip = true
|
assign_public_ip = true
|
||||||
}
|
}
|
||||||
tags = each.value.tag
|
tags = local.onprem_tag
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user