File tree Expand file tree Collapse file tree 3 files changed +20
-10
lines changed
modules/integrations/cloud-logs Expand file tree Collapse file tree 3 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -72,11 +72,12 @@ locals {
7272 kms_account_id = split (" :" , var. kms_key_arn )[3 ]
7373 need_kms_policy = var. bucket_account_id != null && var. bucket_account_id != local. kms_account_id
7474
75- account_id_hash = substr ( md5 (local . bucket_account_id ), 0 , 4 )
76- role_name = " ${ var . name } - ${ random_id . suffix . hex } - ${ local . account_id_hash } "
75+ # Role variables
76+ role_name = split ( " / " , var. role_arn )[ 1 ]
7777
78+ account_id_hash = substr (md5 (local. bucket_account_id ), 0 , 4 )
7879 # StackSet configuration
79- stackset_name = " ${ var . name } -${ random_id . suffix . hex } -${ local . account_id_hash } -stackset"
80+ stackset_name = " sysdig-secure-cloudlogs -${ random_id . suffix . hex } -${ local . account_id_hash } -stackset"
8081
8182 # fetch the AWS Root OU under org
8283 # As per https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#organization-structure, there can be only one root
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ output "kms_policy_instructions" {
99 value = (local. need_kms_policy ) ? templatefile (
1010 " ${ path . module } /templates/kms_policy_instructions.tpl" ,
1111 {
12- role_arn = " arn: ${ data . aws_partition . current . partition } :iam:: ${ local . bucket_account_id } :role/ ${ local . role_name } "
12+ role_arn = var.role_arn
1313 }
1414 ) : " "
1515}
Original file line number Diff line number Diff line change @@ -33,12 +33,6 @@ variable "tags" {
3333 }
3434}
3535
36- variable "name" {
37- description = " (Optional) Name to be assigned to all child resources. A suffix may be added internally when required."
38- type = string
39- default = " sysdig-secure-cloudlogs"
40- }
41-
4236variable "regions" {
4337 description = " (Optional) The list of AWS regions we want to scrape data from"
4438 type = set (string )
@@ -66,6 +60,21 @@ variable "topic_arn" {
6660 }
6761}
6862
63+ variable "role_arn" {
64+ type = string
65+ description = " ARN of the role that terraform will create to download the CloudTrail logs from the S3 bucket."
66+
67+ validation {
68+ condition = var. role_arn != " "
69+ error_message = " Role ARN must not be empty"
70+ }
71+
72+ validation {
73+ condition = can (regex (" ^arn:(aws|aws-us-gov):iam::[0-9]+:role/.+$" , var. role_arn ))
74+ error_message = " Role ARN must be a valid IAM ARN format"
75+ }
76+ }
77+
6978variable "create_topic" {
7079 type = bool
7180 default = false
You can’t perform that action at this time.
0 commit comments