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 {
72
72
kms_account_id = split (" :" , var. kms_key_arn )[3 ]
73
73
need_kms_policy = var. bucket_account_id != null && var. bucket_account_id != local. kms_account_id
74
74
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 ]
77
77
78
+ account_id_hash = substr (md5 (local. bucket_account_id ), 0 , 4 )
78
79
# 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"
80
81
81
82
# fetch the AWS Root OU under org
82
83
# 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" {
9
9
value = (local. need_kms_policy ) ? templatefile (
10
10
" ${ path . module } /templates/kms_policy_instructions.tpl" ,
11
11
{
12
- role_arn = " arn: ${ data . aws_partition . current . partition } :iam:: ${ local . bucket_account_id } :role/ ${ local . role_name } "
12
+ role_arn = var.role_arn
13
13
}
14
14
) : " "
15
15
}
Original file line number Diff line number Diff line change @@ -33,12 +33,6 @@ variable "tags" {
33
33
}
34
34
}
35
35
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
-
42
36
variable "regions" {
43
37
description = " (Optional) The list of AWS regions we want to scrape data from"
44
38
type = set (string )
@@ -66,6 +60,21 @@ variable "topic_arn" {
66
60
}
67
61
}
68
62
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
+
69
78
variable "create_topic" {
70
79
type = bool
71
80
default = false
You can’t perform that action at this time.
0 commit comments