Skip to content

Commit cb9cf08

Browse files
Update ingestion SNS onboarding script (#36)
1 parent ebb3d61 commit cb9cf08

File tree

1 file changed

+14
-8
lines changed
  • modules/integrations/cloud-logs

1 file changed

+14
-8
lines changed

modules/integrations/cloud-logs/main.tf

+14-8
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ locals {
4040
account_id_hash = substr(md5(data.aws_caller_identity.current.account_id), 0, 4)
4141
role_name = "${var.name}-${random_id.suffix.hex}-${local.account_id_hash}"
4242
bucket_arn = regex("^([^/]+)", var.folder_arn)[0]
43-
bucket_name = var.is_gov_cloud_onboarding ? replace(local.bucket_arn, "arn:aws-us-gov:s3:::", "") : replace(local.bucket_arn, "arn:aws:s3:::", "")
44-
bucket_region = data.aws_s3_bucket.cloudtrail_bucket.region
4543
trusted_identity = var.is_gov_cloud_onboarding ? data.sysdig_secure_trusted_cloud_identity.trusted_identity.gov_identity : data.sysdig_secure_trusted_cloud_identity.trusted_identity.identity
4644

4745
topic_name = split(":", var.topic_arn)[5]
@@ -107,11 +105,21 @@ data "aws_iam_policy_document" "cloudlogs_s3_access" {
107105
"${local.bucket_arn}/*"
108106
]
109107
}
110-
}
111108

112-
# Fetch the S3 bucket information
113-
data "aws_s3_bucket" "cloudtrail_bucket" {
114-
bucket = local.bucket_name
109+
statement {
110+
sid = "CloudlogsS3AccessList"
111+
112+
effect = "Allow"
113+
114+
actions = [
115+
"s3:List*"
116+
]
117+
118+
resources = [
119+
local.bucket_arn,
120+
"${local.bucket_arn}/*"
121+
]
122+
}
115123
}
116124

117125
#-----------------------------------------------------------------------------------------------------------------------
@@ -163,8 +171,6 @@ resource "sysdig_secure_cloud_auth_account_component" "aws_cloud_logs" {
163171
cloudtrailSns = {
164172
role_name = local.role_name
165173
topic_arn = var.topic_arn
166-
subscription_arn = aws_sns_topic_subscription.cloudtrail_notifications.arn
167-
bucket_region = local.bucket_region
168174
bucket_arn = local.bucket_arn
169175
ingested_regions = var.regions
170176
routing_key = local.routing_key

0 commit comments

Comments
 (0)