File tree 6 files changed +28
-14
lines changed
integrations/event-bridge
6 files changed +28
-14
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,14 @@ There are four new parameters to configure organizational deployments on the clo
75
75
76
76
** WARNING** : module variable ` organizational_unit_ids ` / ` org_units ` will be DEPRECATED soon going forward. Please work with Sysdig to migrate your Terraform installs to use ` include_ouids ` instead to achieve the same deployment outcome.
77
77
78
+ ### Stackset Instances Installation
79
+
80
+ If new OUs are added in the Include OUIDs list, the existing stackset instances will not get recreated and TF will only create the stackset instances for the newly added OUs.
81
+
82
+ ** Note** : This applies to only OUs added/removed to/from the organizational configuration. If accounts are added/removed from the Exclude Accounts or Include Extra Accounts list, it will end up recreating the stackset instances.
83
+
84
+ <br />
85
+
78
86
## Best practices
79
87
80
88
For contributing to existing modules or adding new modules, below are some of the best practices recommended :-
Original file line number Diff line number Diff line change @@ -183,12 +183,15 @@ TEMPLATE
183
183
184
184
# stackset instance to deploy resources for agentless scanning, in all regions of each account in all organization units
185
185
resource "aws_cloudformation_stack_set_instance" "ou_stackset_instance" {
186
- for_each = var. is_organizational ? local. region_set : toset ([])
187
- region = each. key
186
+ for_each = var. is_organizational ? {
187
+ for pair in setproduct (local. region_set , local. deployment_targets_org_units ) :
188
+ " ${pair[0]}-${pair[1]}" => pair
189
+ } : {}
188
190
191
+ region = each. value [0 ]
189
192
stack_set_name = aws_cloudformation_stack_set. ou_resources_stackset [0 ]. name
190
193
deployment_targets {
191
- organizational_unit_ids = local . deployment_targets_org_units
194
+ organizational_unit_ids = [ each . value [ 1 ]]
192
195
accounts = local. check_old_ouid_param ? null : (local. deployment_targets_accounts_filter == " NONE" ? null : local. deployment_targets_accounts . accounts_to_deploy )
193
196
account_filter_type = local. check_old_ouid_param ? null : local. deployment_targets_accounts_filter
194
197
}
Original file line number Diff line number Diff line change @@ -76,12 +76,12 @@ TEMPLATE
76
76
}
77
77
78
78
resource "aws_cloudformation_stack_set_instance" "stackset_instance" {
79
- count = var. is_organizational ? 1 : 0
79
+ for_each = var. is_organizational ? toset (local . deployment_targets_org_units ) : []
80
80
81
81
region = var. region == " " ? null : var. region
82
82
stack_set_name = aws_cloudformation_stack_set. stackset [0 ]. name
83
83
deployment_targets {
84
- organizational_unit_ids = local . deployment_targets_org_units
84
+ organizational_unit_ids = [ each . value ]
85
85
accounts = local. check_old_ouid_param ? null : (local. deployment_targets_accounts_filter == " NONE" ? null : local. deployment_targets_accounts . accounts_to_deploy )
86
86
account_filter_type = local. check_old_ouid_param ? null : local. deployment_targets_accounts_filter
87
87
}
Original file line number Diff line number Diff line change @@ -65,12 +65,15 @@ resource "aws_cloudformation_stack_set" "eb_role_stackset" {
65
65
}
66
66
67
67
resource "aws_cloudformation_stack_set_instance" "eb_rule_api_dest_instance" {
68
- for_each = var. is_organizational ? local. region_set : toset ([])
69
- region = each. key
68
+ for_each = var. is_organizational ? {
69
+ for pair in setproduct (local. region_set , local. deployment_targets_org_units ) :
70
+ " ${pair[0]}-${pair[1]}" => pair
71
+ } : {}
70
72
73
+ region = each. value [0 ]
71
74
stack_set_name = aws_cloudformation_stack_set. eb_rule_api_dest_stackset [0 ]. name
72
75
deployment_targets {
73
- organizational_unit_ids = local . deployment_targets_org_units
76
+ organizational_unit_ids = [ each . value [ 1 ]]
74
77
accounts = local. check_old_ouid_param ? null : (local. deployment_targets_accounts_filter == " NONE" ? null : local. deployment_targets_accounts . accounts_to_deploy )
75
78
account_filter_type = local. check_old_ouid_param ? null : local. deployment_targets_accounts_filter
76
79
}
@@ -89,11 +92,11 @@ resource "aws_cloudformation_stack_set_instance" "eb_rule_api_dest_instance" {
89
92
}
90
93
91
94
resource "aws_cloudformation_stack_set_instance" "eb_role_stackset_instance" {
92
- count = var. is_organizational ? 1 : 0
95
+ for_each = var. is_organizational ? toset (local . deployment_targets_org_units ) : []
93
96
94
97
stack_set_name = aws_cloudformation_stack_set. eb_role_stackset [0 ]. name
95
98
deployment_targets {
96
- organizational_unit_ids = local . deployment_targets_org_units
99
+ organizational_unit_ids = [ each . value ]
97
100
accounts = local. check_old_ouid_param ? null : (local. deployment_targets_accounts_filter == " NONE" ? null : local. deployment_targets_accounts . accounts_to_deploy )
98
101
account_filter_type = local. check_old_ouid_param ? null : local. deployment_targets_accounts_filter
99
102
}
Original file line number Diff line number Diff line change @@ -54,12 +54,12 @@ TEMPLATE
54
54
}
55
55
56
56
resource "aws_cloudformation_stack_set_instance" "stackset_instance" {
57
- count = var. is_organizational ? 1 : 0
57
+ for_each = var. is_organizational ? toset (local . deployment_targets_org_units ) : []
58
58
59
59
region = var. region == " " ? null : var. region
60
60
stack_set_name = aws_cloudformation_stack_set. stackset [0 ]. name
61
61
deployment_targets {
62
- organizational_unit_ids = local . deployment_targets_org_units
62
+ organizational_unit_ids = [ each . value ]
63
63
accounts = local. check_old_ouid_param ? null : (local. deployment_targets_accounts_filter == " NONE" ? null : local. deployment_targets_accounts . accounts_to_deploy )
64
64
account_filter_type = local. check_old_ouid_param ? null : local. deployment_targets_accounts_filter
65
65
}
Original file line number Diff line number Diff line change @@ -120,11 +120,11 @@ resource "aws_cloudformation_stack_set" "scanning_role_stackset" {
120
120
121
121
# stackset instance to deploy agentless scanning role, in all organization units
122
122
resource "aws_cloudformation_stack_set_instance" "scanning_role_stackset_instance" {
123
- count = var. is_organizational ? 1 : 0
123
+ for_each = var. is_organizational ? toset (local . deployment_targets_org_units ) : []
124
124
125
125
stack_set_name = aws_cloudformation_stack_set. scanning_role_stackset [0 ]. name
126
126
deployment_targets {
127
- organizational_unit_ids = local . deployment_targets_org_units
127
+ organizational_unit_ids = [ each . value ]
128
128
accounts = local. check_old_ouid_param ? null : (local. deployment_targets_accounts_filter == " NONE" ? null : local. deployment_targets_accounts . accounts_to_deploy )
129
129
account_filter_type = local. check_old_ouid_param ? null : local. deployment_targets_accounts_filter
130
130
}
You can’t perform that action at this time.
0 commit comments