Skip to content

Commit 9cbec0a

Browse files
committed
Merge branch 'master' into feat-zones-v2-support
2 parents dc31a5c + 56617d8 commit 9cbec0a

55 files changed

Lines changed: 1715 additions & 1087 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Workload with Serverless Workload Agent
2+
This example deploys a cluster running a workload application secured by the Serverless Workload Agent.
3+
The workload used is [falcosecurity/event-generator](https://github.com/falcosecurity/event-generator), which produces synthetic suspicious actions that will trigger Sysdig managed policies.
4+
5+
6+
## Prerequisites
7+
The following prerequisites are required to deploy this sample:
8+
- `VPC ID`, the ID of an already existing VPC
9+
- `Subnet ID`, the ID of an already existing Subnet within the VPC above
10+
11+
12+
## Usage
13+
```
14+
$ terraform init
15+
$ terraform apply
16+
```
17+
18+
19+
## Components
20+
| **Component** | **Name** | **Description** |
21+
|--------------------|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
22+
| ECS Cluster | `<prefix>-cluster` | The cluster containing the ECS Service below. |
23+
| ECS Service | `<prefix>-service` | The service running the TaskDefinition below. |
24+
| ECS TaskDefinition | `<prefix>-task-definition` | The task definition including a workload container being secured by the Serverless Agent. |
25+
| ECS SecurityGroup | `<prefix>-security-group` | The security group ensuring connectivity to the Serverless Agent. This security group has no restrictions applied and is intended for testing only. |
26+
27+
28+
## Files
29+
| **File** | **Description** |
30+
|----------------|----------------------------------------------------------------------------------------------------------|
31+
| `output.tf` | Contains the reference to the cluster, service, and task revision being deployed. |
32+
| `providers.tf` | Contains the configuration parameters for the providers. |
33+
| `resources.tf` | Contains the resources to deploy, including the task definition being secured with the Serverless Agent. |
34+
| `variables.tf` | Contains the configuration parameters for AWS and the Serverless Agent. |
35+
| `versions.tf` | Defines the version of the providers. |
File renamed without changes.

examples/serverless-agent/fargate/workload-legacy/providers.tf renamed to examples/serverless-agent/ecs-fargate/providers.tf

File renamed without changes.

examples/serverless-agent/fargate/workload/instrumented_load.tf renamed to examples/serverless-agent/ecs-fargate/resources.tf

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,7 @@ data "sysdig_fargate_workload_agent" "containers_instrumented" {
77
"logConfiguration" : {
88
"logDriver" : "awslogs",
99
"options" : {
10-
"awslogs-group" : aws_cloudwatch_log_group.instrumented_logs.name,
11-
"awslogs-region" : var.region,
12-
"awslogs-stream-prefix" : "task"
13-
},
14-
}
15-
},
16-
{
17-
"name" : "event-gen-2",
18-
"image" : "falcosecurity/event-generator",
19-
"command" : ["run", "syscall", "--all", "--loop"],
20-
"logConfiguration" : {
21-
"logDriver" : "awslogs",
22-
"options" : {
23-
"awslogs-group" : aws_cloudwatch_log_group.instrumented_logs.name,
10+
"awslogs-group" : aws_cloudwatch_log_group.logs.name,
2411
"awslogs-region" : var.region,
2512
"awslogs-stream-prefix" : "task"
2613
},
@@ -35,19 +22,19 @@ data "sysdig_fargate_workload_agent" "containers_instrumented" {
3522
collector_port = var.collector_port
3623

3724
log_configuration {
38-
group = aws_cloudwatch_log_group.instrumented_logs.name
25+
group = aws_cloudwatch_log_group.logs.name
3926
stream_prefix = "instrumentation"
4027
region = var.region
4128
}
4229
}
4330

4431
resource "aws_ecs_task_definition" "task_definition" {
45-
family = "${var.prefix}-instrumented-task-definition"
32+
family = "${var.prefix}-task-definition"
4633
task_role_arn = aws_iam_role.task_role.arn
4734
execution_role_arn = aws_iam_role.execution_role.arn
4835

49-
cpu = "256"
50-
memory = "512"
36+
cpu = "512"
37+
memory = "1024"
5138
network_mode = "awsvpc"
5239
requires_compatibilities = ["FARGATE"]
5340
pid_mode = "task"
@@ -57,10 +44,10 @@ resource "aws_ecs_task_definition" "task_definition" {
5744

5845

5946
resource "aws_ecs_cluster" "cluster" {
60-
name = "${var.prefix}-instrumented-workload"
47+
name = "${var.prefix}-cluster"
6148
}
6249

63-
resource "aws_cloudwatch_log_group" "instrumented_logs" {
50+
resource "aws_cloudwatch_log_group" "logs" {
6451
}
6552

6653
data "aws_iam_policy_document" "assume_role_policy" {
@@ -106,7 +93,7 @@ data "aws_iam_policy_document" "task_policy" {
10693
}
10794

10895
resource "aws_ecs_service" "service" {
109-
name = "${var.prefix}-instrumented-service"
96+
name = "${var.prefix}-service"
11097

11198
cluster = aws_ecs_cluster.cluster.id
11299
task_definition = aws_ecs_task_definition.task_definition.arn
@@ -115,7 +102,7 @@ resource "aws_ecs_service" "service" {
115102
platform_version = "1.4.0"
116103

117104
network_configuration {
118-
subnets = [var.subnet_1, var.subnet_2]
105+
subnets = [var.subnet]
119106
security_groups = [aws_security_group.security_group.id]
120107
assign_public_ip = true
121108
}
@@ -126,7 +113,7 @@ resource "aws_security_group" "security_group" {
126113
vpc_id = var.vpc_id
127114
}
128115

129-
resource "aws_security_group_rule" "orchestrator_agent_ingress_rule" {
116+
resource "aws_security_group_rule" "ingress_rule" {
130117
type = "ingress"
131118
protocol = "tcp"
132119
from_port = 0
@@ -135,7 +122,7 @@ resource "aws_security_group_rule" "orchestrator_agent_ingress_rule" {
135122
security_group_id = aws_security_group.security_group.id
136123
}
137124

138-
resource "aws_security_group_rule" "orchestrator_agent_egress_rule" {
125+
resource "aws_security_group_rule" "egress_rule" {
139126
type = "egress"
140127
protocol = "all"
141128
from_port = 0

examples/serverless-agent/fargate/workload/variables.tf renamed to examples/serverless-agent/ecs-fargate/variables.tf

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,15 @@ variable "profile" {
99
}
1010

1111
variable "region" {
12-
description = "AWS Region for deployment"
13-
default = "us-east-1"
12+
description = "AWS Region for deployment, for example: us-east-1"
1413
}
1514

16-
variable "subnet_1" {
17-
description = "Subnet-1 Id"
18-
}
19-
20-
variable "subnet_2" {
21-
description = "Subnet-2 Id"
15+
variable "vpc_id" {
16+
description = "VPC Id (for example: vpc-1234567890abcde)"
2217
}
2318

24-
variable "vpc_id" {
25-
description = "VPC Id"
19+
variable "subnet" {
20+
description = "Subnet Id (for example: subnet-1234567890abcde)"
2621
}
2722

2823
variable "tags" {
@@ -33,7 +28,7 @@ variable "tags" {
3328

3429
variable "replicas" {
3530
description = "Number of workload replicas to run"
36-
default = 2
31+
default = 1
3732
}
3833

3934
# Serverless Agent Configuration

examples/serverless-agent/fargate/orchestrator/versions.tf renamed to examples/serverless-agent/ecs-fargate/versions.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = "~> 5.35.0"
8-
}
9-
local = {
10-
source = "hashicorp/local"
11-
version = "~> 2.4.1"
7+
version = "~>6.32.0"
128
}
139
sysdig = {
1410
source = "sysdiglabs/sysdig"
15-
version = "~> 1.24.5"
11+
version = "~>3.4.0"
1612
}
1713
}
1814
}

examples/serverless-agent/fargate/orchestrator/README.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

examples/serverless-agent/fargate/orchestrator/orchestrator.tf

Lines changed: 0 additions & 36 deletions
This file was deleted.

examples/serverless-agent/fargate/orchestrator/output.tf

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/serverless-agent/fargate/orchestrator/providers.tf

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)