Skip to content

Commit 6f5a018

Browse files
authored
chore: Add telemetry for terraform (#79)
* chore: add telemetry using new chart variable * fix: use https for precommit repo * fix: cloud-connector file for precommit * fix: fmt files
1 parent eb821fb commit 6f5a018

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
# language: script
2222
# verbose: true
2323

24-
- repo: git://github.com/antonbabenko/pre-commit-terraform
24+
- repo: https://github.com/antonbabenko/pre-commit-terraform
2525
rev: v1.64.0
2626
hooks:
2727
- id: terraform_fmt
@@ -47,7 +47,7 @@ repos:
4747
- '--args=--only=terraform_required_providers'
4848
- '--args=--only=terraform_standard_module_structure'
4949
- '--args=--only=terraform_workspace_remote'
50-
- repo: git://github.com/pre-commit/pre-commit-hooks
50+
- repo: https://github.com/pre-commit/pre-commit-hooks
5151
rev: v4.1.0
5252
hooks:
5353
- id: check-merge-conflict

examples-internal/organizational-k8s-threat-reuse_cloudtrail_s3/cloud-connector.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ resource "helm_release" "cloud_connector" {
4040
value = data.aws_region.current.name
4141
}
4242

43+
set {
44+
name = "telemetryDeploymentMethod"
45+
value = "terraform_aws_k8s_org"
46+
}
47+
4348
values = [
4449
<<CONFIG
4550
logging: info

examples-internal/use-cases-self-baked/multiple-accounts-k8s-threat.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ Skip step 4 and remove `aws_access_key_id` and `aws_secret_access_key` parameter
3636

3737
## Solution
3838

39-
For clients that only require thread-detection feature, and do not have an organizational cloudtrail setup, but multiple-accounts,
39+
For clients that only require thread-detection feature, and do not have an organizational cloudtrail setup, but multiple-accounts,
4040
we can make use of the [cloud-connector `aws-cloudtrail-s3-sns-sqs` ingestor](https://charts.sysdig.com/charts/cloud-connector/#ingestors)
4141

42-
This processes through a single SQS AWS queue the events that come through a single S3 bucket (through an SNS topic) or
42+
This processes through a single SQS AWS queue the events that come through a single S3 bucket (through an SNS topic) or
4343
multiple S3 buckets (that through several SNS topics, report to a single SQS topic).
4444

4545
## Suggested building-blocks
@@ -86,11 +86,11 @@ provider "helm" {
8686

8787
3. **Cloudtrail-S3-SNS-SQS**
8888

89-
WIP.
89+
WIP.
9090

9191
Create an SQS que that will subscribe to one S3-SNS (1) or several S3 buckets SNS topics (2)
9292

93-
We currently provide a module to create first use-case,
93+
We currently provide a module to create first use-case,
9494
[one S3-SNS-SQS](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/tree/master/modules/infrastructure/cloudtrail_s3-sns-sqs) (1),
9595
but can work on providing a way to automatize the later (2)
9696

@@ -143,7 +143,7 @@ module "multi-account" {
143143
-->
144144

145145
5. **Sysdig workload deployment on K8s**
146-
146+
147147
* Populate `sysdig_secure_url`, `SYSDID_SECURE_API_TOKEN` and `REGION`
148148
* WIP. enable terraform module to be able to define [`nodeSelector` and `tolerations` parameters of the cloud-connector helm chart](https://charts.sysdig.com/charts/cloud-connector/#configuration)
149149

@@ -189,12 +189,12 @@ resource "helm_release" "cloud_connector" {
189189
name = "aws.region"
190190
value = "<REGION>"
191191
}
192-
192+
193193
set {
194194
name = "nodeSelector.<NODE_SELECTOR_LABEL>"
195195
value = "<NODE_SELECTOR_LABEL_VALUE>"
196196
}
197-
197+
198198
set {
199199
name = "tolerations[0].key"
200200
value = "<TOLERATION_KEY>"

examples/single-account-k8s/cloud-connector.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ resource "helm_release" "cloud_connector" {
6464
value = data.aws_region.current.name
6565
}
6666

67+
set {
68+
name = "telemetryDeploymentMethod"
69+
value = "terraform_aws_k8s_single"
70+
}
71+
6772
values = [
6873
yamlencode({
6974
ingestors = [

modules/infrastructure/cloudtrail_s3-sns-sqs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ It requires:
1010
This module helps with the creation of the SQS queue from which to pull the cloudtrail events, leveraging the S3 "bucket event notification" system.
1111

1212
Module gets the cloudtrail-s3 bucket name as input and provides the sqs topic url as output.
13-
13+
1414
# How it works
1515

1616
- This module's output will be visible in the `S3` console, after entering a bucket, in it's `Properties`, `Event notifications` section.

modules/services/cloud-connector/ecs-service.tf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,15 @@ resource "aws_ecs_task_definition" "task_definition" {
5757

5858

5959
locals {
60+
suffix_org = var.is_organizational ? "org" : "single"
6061
task_env_vars = concat([
6162
{
6263
name = "VERIFY_SSL"
6364
value = tostring(local.verify_ssl)
6465
},
6566
{
66-
name = "TELEMETRY_DEPLOYMENT_METHOD"
67-
value = "terraform"
68-
},
69-
{
70-
name = "FEAT_REGISTER_ACCOUNT_IN_SECURE"
71-
value = "true"
67+
name = "telemetryDeploymentMethod"
68+
value = "terraform_aws_ecs_${local.suffix_org}"
7269
},
7370
{
7471
name = "CONFIG_PATH"

0 commit comments

Comments
 (0)