Skip to content

Commit b1c454d

Browse files
SSPROD-57377 - Add extra time to CIEM advanced in order to avoid race condition with CIEM basic
1 parent 46fd639 commit b1c454d

File tree

10 files changed

+64
-4
lines changed

10 files changed

+64
-4
lines changed

modules/integrations/cloud-logs/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,17 @@ resource "sysdig_secure_cloud_auth_account_component" "aws_cloud_logs" {
338338
aws_cloudformation_stack_set_instance.cloudlogs_s3_access_topic
339339
]
340340
}
341+
342+
locals {
343+
wait_duration = format("%ds", var.wait_after_basic_seconds)
344+
}
345+
346+
resource "time_sleep" "wait_after_ciem_basic" {
347+
count = var.wait_after_basic_seconds > 0 ? 1 : 0
348+
create_duration = local.wait_duration
349+
}
350+
351+
output "wait_after_basic" {
352+
value = var.wait_after_basic_seconds > 0 ? time_sleep.wait_after_ciem_basic : null
353+
description = "Wait handle to delay downstream operations after basic by the configured seconds."
354+
}

modules/integrations/cloud-logs/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,9 @@ variable "kms_key_arn" {
100100
type = string
101101
default = null
102102
}
103+
104+
variable "wait_after_basic_seconds" {
105+
type = number
106+
description = "Number of seconds to wait after CIEM basic before proceeding (set to 0 to disable)."
107+
default = 30
108+
}

modules/integrations/cloud-logs/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ terraform {
1515
source = "hashicorp/random"
1616
version = ">= 3.1"
1717
}
18+
time = {
19+
source = "hashicorp/time"
20+
version = ">= 0.9"
21+
}
1822
}
1923
}

modules/integrations/event-bridge/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,3 +295,17 @@ resource "sysdig_secure_cloud_auth_account_component" "aws_event_bridge" {
295295
}
296296
})
297297
}
298+
299+
locals {
300+
wait_duration = format("%ds", var.wait_after_basic_seconds)
301+
}
302+
303+
resource "time_sleep" "wait_after_ciem_basic" {
304+
count = var.wait_after_basic_seconds > 0 ? 1 : 0
305+
create_duration = local.wait_duration
306+
}
307+
308+
output "wait_after_basic" {
309+
value = var.wait_after_basic_seconds > 0 ? time_sleep.wait_after_ciem_basic : null
310+
description = "Wait handle to delay downstream operations after basic (e.g., CIEM) by the configured seconds."
311+
}

modules/integrations/event-bridge/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,9 @@ variable "api_dest_rate_limit" {
131131
default = 300
132132
description = "Rate limit for API Destinations"
133133
}
134+
135+
variable "wait_after_basic_seconds" {
136+
type = number
137+
description = "Number of seconds to wait after CIEM basic before proceeding (set to 0 to disable)."
138+
default = 30
139+
}

modules/integrations/event-bridge/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@ terraform {
1313
source = "hashicorp/random"
1414
version = ">= 3.1"
1515
}
16+
time = {
17+
source = "hashicorp/time"
18+
version = ">= 0.9"
19+
}
1620
}
1721
}

test/examples/single_account/cloud_logs.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ resource "sysdig_secure_cloud_auth_account_feature" "identity_entitlement_advanc
4545
sysdig_secure_cloud_auth_account_feature.identity_entitlement_basic.components,
4646
[module.cloud-logs.cloud_logs_component_id]
4747
)
48-
depends_on = [module.cloud-logs]
48+
depends_on = [
49+
module.cloud-logs,
50+
module.cloud-logs.wait_after_basic
51+
]
4952
flags = {
5053
"CIEM_FEATURE_MODE" = "advanced"
5154
}

test/examples/single_account/cloud_logs_gov.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ resource "sysdig_secure_cloud_auth_account_feature" "identity_entitlement_advanc
2323
type = "FEATURE_SECURE_IDENTITY_ENTITLEMENT"
2424
enabled = true
2525
components = concat(sysdig_secure_cloud_auth_account_feature.identity_entitlement_basic.components, [module.cloud-logs.cloud_logs_component_id])
26-
depends_on = [module.cloud-logs]
26+
depends_on = [
27+
module.cloud-logs,
28+
module.cloud-logs.wait_after_basic
29+
]
2730
flags = { "CIEM_FEATURE_MODE" : "advanced" }
2831

2932
lifecycle {

test/examples/single_account/event_bridge.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ resource "sysdig_secure_cloud_auth_account_feature" "identity_entitlement_advanc
2222
type = "FEATURE_SECURE_IDENTITY_ENTITLEMENT"
2323
enabled = true
2424
components = concat(sysdig_secure_cloud_auth_account_feature.identity_entitlement_basic.components, [module.event-bridge.event_bridge_component_id])
25-
depends_on = [module.event-bridge]
25+
depends_on = [
26+
module.event-bridge,
27+
module.event-bridge.wait_after_basic
28+
]
2629
flags = { "CIEM_FEATURE_MODE" : "advanced" }
2730

2831
lifecycle {

test/examples/single_account/event_bridge_gov.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ resource "sysdig_secure_cloud_auth_account_feature" "identity_entitlement_advanc
2323
type = "FEATURE_SECURE_IDENTITY_ENTITLEMENT"
2424
enabled = true
2525
components = concat(sysdig_secure_cloud_auth_account_feature.identity_entitlement_basic.components, [module.event-bridge.event_bridge_component_id])
26-
depends_on = [module.event-bridge]
26+
depends_on = [
27+
module.event-bridge,
28+
module.event-bridge.wait_after_basic
29+
]
2730
flags = { "CIEM_FEATURE_MODE" : "advanced" }
2831

2932
lifecycle {

0 commit comments

Comments
 (0)