Skip to content

Commit b45d453

Browse files
fix: Remove legacy benchmark task creation (#165)
Removes creation of a deprecated resource. Benchmarks has been replaced by a new Compliance system, which is triggered by the creation of the cloud account. The explicit creation of a benchmark task is thus not needed, and is failing since the API has been disabled.
1 parent 7472786 commit b45d453

File tree

16 files changed

+3
-84
lines changed

16 files changed

+3
-84
lines changed

Diff for: examples/organizational/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ $ terraform apply
187187
|------|-------------|------|---------|:--------:|
188188
| <a name="input_sysdig_secure_for_cloud_member_account_id"></a> [sysdig\_secure\_for\_cloud\_member\_account\_id](#input\_sysdig\_secure\_for\_cloud\_member\_account\_id) | organizational member account where the secure-for-cloud workload is going to be deployed | `string` | n/a | yes |
189189
| <a name="input_autoscaling_config"></a> [autoscaling\_config](#input\_autoscaling\_config) | if enable\_autoscaliing is enabled, ECS autoscaling configuration. for more insight check source code | <pre>object({<br> min_replicas = number<br> max_replicas = number<br> upscale_threshold = number<br> downscale_threshold = number<br> })</pre> | <pre>{<br> "downscale_threshold": 30,<br> "max_replicas": 15,<br> "min_replicas": 2,<br> "upscale_threshold": 60<br>}</pre> | no |
190-
| <a name="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions) | List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default. | `list(string)` | `[]` | no |
191190
| <a name="input_cloudtrail_is_multi_region_trail"></a> [cloudtrail\_is\_multi\_region\_trail](#input\_cloudtrail\_is\_multi\_region\_trail) | true/false whether the created cloudtrail will ingest multi-regional events. testing/economization purpose. | `bool` | `true` | no |
192191
| <a name="input_cloudtrail_kms_enable"></a> [cloudtrail\_kms\_enable](#input\_cloudtrail\_kms\_enable) | true/false whether the created cloudtrail should deliver encrypted events to s3 | `bool` | `true` | no |
193192
| <a name="input_cloudtrail_s3_bucket_expiration_days"></a> [cloudtrail\_s3\_bucket\_expiration\_days](#input\_cloudtrail\_s3\_bucket\_expiration\_days) | Number of days that the logs will persist in the bucket | `number` | `5` | no |

Diff for: examples/organizational/cloud-bench.tf

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module "cloud_bench_org" {
99
name = "${var.name}-cloudbench"
1010
is_organizational = true
1111
region = data.aws_region.current.name
12-
benchmark_regions = var.benchmark_regions
1312

1413
tags = var.tags
1514
}
@@ -25,7 +24,6 @@ module "cloud_bench_single" {
2524
name = "${var.name}-cloudbench"
2625
is_organizational = false
2726
region = data.aws_region.current.name
28-
benchmark_regions = var.benchmark_regions
2927

3028
tags = var.tags
3129
}

Diff for: examples/organizational/variables.tf

-6
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ variable "deploy_benchmark_organizational" {
126126
description = "true/false whether benchmark module should be deployed on organizational or single-account mode (1 role per org accounts if true, 1 role in default aws provider account if false)</li></ul>"
127127
}
128128

129-
variable "benchmark_regions" {
130-
type = list(string)
131-
description = "List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default."
132-
default = []
133-
}
134-
135129

136130
#---------------------------------
137131
# ecs, security group, vpc

Diff for: examples/single-account-apprunner/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ $ terraform apply
9696

9797
| Name | Description | Type | Default | Required |
9898
|------|-------------|------|---------|:--------:|
99-
| <a name="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions) | List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default. | `list(string)` | `[]` | no |
10099
| <a name="input_cloudconnector_ecr_image_uri"></a> [cloudconnector\_ecr\_image\_uri](#input\_cloudconnector\_ecr\_image\_uri) | URI to cloudconnectors image on ECR | `string` | `"public.ecr.aws/o5x4u2t4/cloud-connector:latest"` | no |
101100
| <a name="input_cloudtrail_is_multi_region_trail"></a> [cloudtrail\_is\_multi\_region\_trail](#input\_cloudtrail\_is\_multi\_region\_trail) | true/false whether cloudtrail will ingest multiregional events | `bool` | `true` | no |
102101
| <a name="input_cloudtrail_kms_enable"></a> [cloudtrail\_kms\_enable](#input\_cloudtrail\_kms\_enable) | true/false whether cloudtrail delivered events to S3 should persist encrypted | `bool` | `true` | no |

Diff for: examples/single-account-apprunner/benchmark.tf

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module "cloud_bench" {
22
source = "../../modules/services/cloud-bench"
33
count = var.deploy_benchmark ? 1 : 0
44

5-
name = "${var.name}-cloudbench"
6-
benchmark_regions = var.benchmark_regions
7-
5+
name = "${var.name}-cloudbench"
86
tags = var.tags
97
}

Diff for: examples/single-account-apprunner/variables.tf

-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ variable "deploy_benchmark" {
5858
default = true
5959
}
6060

61-
variable "benchmark_regions" {
62-
type = list(string)
63-
description = "List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default."
64-
default = []
65-
}
66-
6761
#
6862
# general
6963
#

Diff for: examples/single-account-ecs/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ $ terraform apply
9898
| Name | Description | Type | Default | Required |
9999
|------|-------------|------|---------|:--------:|
100100
| <a name="input_autoscaling_config"></a> [autoscaling\_config](#input\_autoscaling\_config) | if enable\_autoscaliing is enabled, ECS autoscaling configuration. for more insight check source code | <pre>object({<br> min_replicas = number<br> max_replicas = number<br> upscale_threshold = number<br> downscale_threshold = number<br> })</pre> | <pre>{<br> "downscale_threshold": 30,<br> "max_replicas": 10,<br> "min_replicas": 1,<br> "upscale_threshold": 60<br>}</pre> | no |
101-
| <a name="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions) | List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default. | `list(string)` | `[]` | no |
102101
| <a name="input_cloud_connector_image"></a> [cloud\_connector\_image](#input\_cloud\_connector\_image) | Image to use for the cloud connector. If empty, the default image will be used. | `string` | `"quay.io/sysdig/cloud-connector:latest"` | no |
103102
| <a name="input_cloudtrail_is_multi_region_trail"></a> [cloudtrail\_is\_multi\_region\_trail](#input\_cloudtrail\_is\_multi\_region\_trail) | true/false whether cloudtrail will ingest multiregional events | `bool` | `true` | no |
104103
| <a name="input_cloudtrail_kms_enable"></a> [cloudtrail\_kms\_enable](#input\_cloudtrail\_kms\_enable) | true/false whether cloudtrail delivered events to S3 should persist encrypted | `bool` | `true` | no |

Diff for: examples/single-account-ecs/benchmark.tf

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module "cloud_bench" {
22
source = "../../modules/services/cloud-bench"
33
count = var.deploy_benchmark ? 1 : 0
44

5-
name = "${var.name}-cloudbench"
6-
benchmark_regions = var.benchmark_regions
7-
5+
name = "${var.name}-cloudbench"
86
tags = var.tags
97
}

Diff for: examples/single-account-ecs/variables.tf

-6
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ variable "deploy_benchmark" {
110110
default = true
111111
}
112112

113-
variable "benchmark_regions" {
114-
type = list(string)
115-
description = "List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default."
116-
default = []
117-
}
118-
119113
#
120114
# cloud connector connector configuration
121115
#

Diff for: examples/single-account-k8s/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ $ terraform apply
114114

115115
| Name | Description | Type | Default | Required |
116116
|------|-------------|------|---------|:--------:|
117-
| <a name="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions) | List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default. | `list(string)` | `[]` | no |
118117
| <a name="input_cloudtrail_is_multi_region_trail"></a> [cloudtrail\_is\_multi\_region\_trail](#input\_cloudtrail\_is\_multi\_region\_trail) | true/false whether cloudtrail will ingest multiregional events. testing/economization purpose. | `bool` | `true` | no |
119118
| <a name="input_cloudtrail_kms_enable"></a> [cloudtrail\_kms\_enable](#input\_cloudtrail\_kms\_enable) | true/false whether s3 should be encrypted. testing/economization purpose. | `bool` | `true` | no |
120119
| <a name="input_cloudtrail_sns_arn"></a> [cloudtrail\_sns\_arn](#input\_cloudtrail\_sns\_arn) | ARN of a pre-existing cloudtrail\_sns. If defaulted, a new cloudtrail will be created. If specified, deployment region must match Cloudtrail S3 bucket region | `string` | `"create"` | no |

Diff for: examples/single-account-k8s/benchmark.tf

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module "cloud_bench" {
22
source = "../../modules/services/cloud-bench"
33
count = var.deploy_benchmark ? 1 : 0
44

5-
name = "${var.name}-cloudbench"
6-
benchmark_regions = var.benchmark_regions
7-
5+
name = "${var.name}-cloudbench"
86
tags = var.tags
97
}

Diff for: examples/single-account-k8s/variables.tf

-5
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ variable "deploy_benchmark" {
6969
description = "Whether to deploy or not the cloud benchmarking"
7070
default = true
7171
}
72-
variable "benchmark_regions" {
73-
type = list(string)
74-
description = "List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default."
75-
default = []
76-
}
7772

7873
#
7974
# aws iam user configuration

Diff for: modules/services/cloud-bench/README.md

-6
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ This module will be deployed as a StackSet and it will take into account newly m
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
2323
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.62.0 |
24-
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.1.0 |
2524
| <a name="requirement_sysdig"></a> [sysdig](#requirement\_sysdig) | >= 0.5.29 |
2625

2726
## Providers
2827

2928
| Name | Version |
3029
|------|---------|
3130
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.62.0 |
32-
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.1.0 |
3331
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | >= 0.5.29 |
3432

3533
## Modules
@@ -44,9 +42,6 @@ No modules.
4442
| [aws_cloudformation_stack_set_instance.stackset_instance](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set_instance) | resource |
4543
| [aws_iam_role.cloudbench_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
4644
| [aws_iam_role_policy_attachment.cloudbench_security_audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
47-
| [random_integer.hour](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) | resource |
48-
| [random_integer.minute](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) | resource |
49-
| [sysdig_secure_benchmark_task.benchmark_task](https://registry.terraform.io/providers/sysdiglabs/sysdig/latest/docs/resources/secure_benchmark_task) | resource |
5045
| [sysdig_secure_cloud_account.cloud_account](https://registry.terraform.io/providers/sysdiglabs/sysdig/latest/docs/resources/secure_cloud_account) | resource |
5146
| [aws_caller_identity.me](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
5247
| [aws_iam_policy.security_audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy) | data source |
@@ -58,7 +53,6 @@ No modules.
5853

5954
| Name | Description | Type | Default | Required |
6055
|------|-------------|------|---------|:--------:|
61-
| <a name="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions) | List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default. | `list(string)` | `[]` | no |
6256
| <a name="input_is_organizational"></a> [is\_organizational](#input\_is\_organizational) | true/false whether secure-for-cloud should be deployed in an organizational setup (all accounts of org) or not (only on default aws provider account) | `bool` | `false` | no |
6357
| <a name="input_name"></a> [name](#input\_name) | The name of the IAM Role that will be created. | `string` | `"sfc-cloudbench"` | no |
6458
| <a name="input_provision_caller_account"></a> [provision\_caller\_account](#input\_provision\_caller\_account) | true/false whether to provision the aws provider account (if is\_organizational=true management account, if is\_organizational=false it will depend on the provider setup on the caller module | `bool` | `true` | no |

Diff for: modules/services/cloud-bench/main.tf

-29
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ locals {
1616
caller_account = data.aws_caller_identity.me.account_id
1717
member_account_ids = var.is_organizational ? [for a in data.aws_organizations_organization.org[0].non_master_accounts : a.id] : []
1818
account_ids_to_deploy = var.is_organizational && var.provision_caller_account ? concat(local.member_account_ids, [data.aws_organizations_organization.org[0].master_account_id]) : local.member_account_ids
19-
20-
benchmark_task_name = var.is_organizational ? "Organization: ${data.aws_organizations_organization.org[0].id}" : local.caller_account
21-
accounts_scope_clause = var.is_organizational ? "aws.accountId in (\"${join("\", \"", local.account_ids_to_deploy)}\")" : "aws.accountId = \"${local.caller_account}\""
22-
regions_scope_clause = length(var.benchmark_regions) == 0 ? "" : " and aws.region in (\"${join("\", \"", var.benchmark_regions)}\")"
2319
}
2420

2521
#----------------------------------------------------------
@@ -46,31 +42,6 @@ locals {
4642
)
4743
}
4844

49-
resource "random_integer" "minute" {
50-
max = 59
51-
min = 0
52-
}
53-
54-
resource "random_integer" "hour" {
55-
max = 23
56-
min = 0
57-
}
58-
59-
resource "sysdig_secure_benchmark_task" "benchmark_task" {
60-
name = "Sysdig Secure for Cloud (AWS) - ${local.benchmark_task_name} - ${var.name}"
61-
schedule = "${random_integer.minute.result} ${random_integer.hour.result} * * *"
62-
schema = "aws_foundations_bench-1.3.0"
63-
scope = "${local.accounts_scope_clause}${local.regions_scope_clause}"
64-
65-
# Creation of a task requires that the Cloud Account already exists in the backend, and has `role_enabled = true`
66-
# We only want to create the task once the rust relationship is established, otherwise running the task will fail.
67-
depends_on = [
68-
sysdig_secure_cloud_account.cloud_account,
69-
aws_iam_role_policy_attachment.cloudbench_security_audit, # Depends on cloudbench_role implicitly
70-
]
71-
}
72-
73-
7445
#----------------------------------------------------------
7546
# If this is not an Organizational deploy, create role/polices directly
7647
#----------------------------------------------------------

Diff for: modules/services/cloud-bench/variables.tf

-6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ variable "region" {
2020
description = "Default region for resource creation in organization mode"
2121
}
2222

23-
variable "benchmark_regions" {
24-
type = list(string)
25-
description = "List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default."
26-
default = []
27-
}
28-
2923
variable "provision_caller_account" {
3024
type = bool
3125
default = true

Diff for: modules/services/cloud-bench/versions.tf

-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
terraform {
22
required_version = ">= 1.0.0"
33
required_providers {
4-
random = {
5-
source = "hashicorp/random"
6-
version = ">= 3.1.0"
7-
}
8-
94
aws = {
105
version = ">= 3.62.0"
116
}

0 commit comments

Comments
 (0)