Skip to content

Commit d1e7a30

Browse files
add workflow
1 parent c2cdd1b commit d1e7a30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+301
-303
lines changed

.github/git-chglog/CHANGELOG.tpl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ Reverts
1313
{{- if .NoteGroups -}} {{ range .NoteGroups -}}
1414

1515
{{ .Title }}
16-
{{ range .Notes }} {{ .Body }} {{ end }} {{ end -}} {{ end -}} {{ end -}}
16+
{{ range .Notes }} {{ .Body }} {{ end }} {{ end -}} {{ end -}} {{ end -}}

.github/git-chglog/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ options:
2323
- Subject
2424
notes:
2525
keywords:
26-
- BREAKING CHANGE
26+
- BREAKING CHANGE

.github/workflows/ci-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ jobs:
5151
run: |
5252
go install github.com/onsi/ginkgo/ginkgo@latest
5353
- name: Test
54-
run: make test
54+
run: make test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ crash.log
3131
.envrc
3232
.direnv
3333
.DS_Store
34-
.idea/
34+
.idea/

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ It's recommended to use an .envrc file to keep environment variables under contr
3131

3232
## Release
3333

34-
- push a new tag and the Github Action will draft a release (with notes)
34+
- push a new tag and the Github Action will draft a release (with notes)

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ clean:
2727

2828
.PHONY: test
2929
test:
30-
$(MAKE) -C test test
30+
$(MAKE) -C test test

modules/agentless-scanning/locals.tf

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ data "aws_organizations_organization" "org" {
99
locals {
1010
# check if both old and new org parameters are provided, we fail early
1111
both_org_configuration_params = var.is_organizational && length(var.org_units) > 0 && (
12-
length(var.include_ouids) > 0 ||
13-
length(var.exclude_ouids) > 0 ||
14-
length(var.include_accounts) > 0 ||
15-
length(var.exclude_accounts) > 0
12+
length(var.include_ouids) > 0 ||
13+
length(var.exclude_ouids) > 0 ||
14+
length(var.include_accounts) > 0 ||
15+
length(var.exclude_accounts) > 0
1616
)
1717

1818
# check if old org_units parameter is provided, for backwards compatibility we will always give preference to it
@@ -25,14 +25,14 @@ locals {
2525

2626
check "validate_org_configuration_params" {
2727
assert {
28-
condition = length(var.org_units) == 0 # if this condition is false we throw warning
28+
condition = length(var.org_units) == 0 # if this condition is false we throw warning
2929
error_message = <<-EOT
3030
WARNING: TO BE DEPRECATED 'org_units' on 30th November, 2025. Please work with Sysdig to migrate your Terraform installs to use 'include_ouids' instead.
3131
EOT
3232
}
3333

3434
assert {
35-
condition = !local.both_org_configuration_params # if this condition is false we throw error
35+
condition = !local.both_org_configuration_params # if this condition is false we throw error
3636
error_message = <<-EOT
3737
ERROR: If both org_units and include_ouids/exclude_ouids/include_accounts/exclude_accounts variables are populated,
3838
ONLY org_units will be considered. Please use only one of the two methods.
@@ -70,19 +70,19 @@ locals {
7070
# case1 - if old method is used where ONLY org_units is provided, use those
7171
local.check_old_ouid_param ? (
7272
"old_ouid_param"
73-
) : (
73+
) : (
7474
# case2 - if no include/exclude ous provided, include entire org
7575
var.is_organizational && length(var.include_ouids) == 0 && length(var.exclude_ouids) == 0 ? (
7676
"entire_org"
77-
) : (
77+
) : (
7878
# case3 - if only included ouids provided, include those ous only
7979
var.is_organizational && length(var.include_ouids) > 0 && length(var.exclude_ouids) == 0 ? (
8080
"included_ous_only"
81-
) : (
81+
) : (
8282
# case4 - if only excluded ouids provided, exclude their accounts from rest of org
8383
var.is_organizational && length(var.include_ouids) == 0 && length(var.exclude_ouids) > 0 ? (
8484
"excluded_ous_only"
85-
) : (
85+
) : (
8686
# case5 - if both include and exclude ouids are provided, includes override excludes
8787
var.is_organizational && length(var.include_ouids) > 0 && length(var.exclude_ouids) > 0 ? (
8888
"mixed_ous"
@@ -99,7 +99,7 @@ locals {
9999
org_units_to_deploy = var.org_units
100100
}
101101
entire_org = {
102-
org_units_to_deploy = local.root_org_unit
102+
org_units_to_deploy = local.root_org_unit
103103
}
104104
included_ous_only = {
105105
org_units_to_deploy = var.include_ouids
@@ -117,7 +117,7 @@ locals {
117117
}
118118
}
119119

120-
# final targets to deploy organizational resources in
120+
# final targets to detargets to deploy organizational resources in
121121
deployment_targets_ous = lookup(local.deployment_options, local.org_configuration, local.deployment_options.default)
122122

123123
// check if root is part of the excluded_ouids
@@ -140,15 +140,15 @@ locals {
140140
# case1 - if old method is used where ONLY org_units is provided, this configuration is a noop
141141
local.check_old_ouid_param ? (
142142
"NONE"
143-
) : (
143+
) : (
144144
# case2 - if only included accounts provided, include those accts as well
145145
var.is_organizational && length(var.include_accounts) > 0 && length(var.exclude_accounts) == 0 ? (
146146
"UNION"
147-
) : (
147+
) : (
148148
# case3 - if only excluded accounts or only excluded ouids provided, exclude those accounts
149-
var.is_organizational && length(var.include_accounts) == 0 && ( length(var.exclude_accounts) > 0 || local.org_configuration == "excluded_ous_only" ) ? (
149+
var.is_organizational && length(var.include_accounts) == 0 && (length(var.exclude_accounts) > 0 || local.org_configuration == "excluded_ous_only") ? (
150150
"DIFFERENCE"
151-
) : (
151+
) : (
152152
# case4 - if both include and exclude accounts are provided, includes override excludes
153153
var.is_organizational && length(var.include_accounts) > 0 && length(var.exclude_accounts) > 0 ? (
154154
"MIXED"
@@ -158,30 +158,30 @@ locals {
158158
)
159159
)
160160

161-
ou_accounts_to_exclude = flatten([ for ou_accounts in data.aws_organizations_organizational_unit_descendant_accounts.ou_accounts_to_exclude: [ ou_accounts.accounts[*].id ] ])
162-
accounts_to_exclude = setunion(local.ou_accounts_to_exclude, var.exclude_accounts)
161+
ou_accounts_to_exclude = flatten([for ou_accounts in data.aws_organizations_organizational_unit_descendant_accounts.ou_accounts_to_exclude : [ou_accounts.accounts[*].id]])
162+
accounts_to_exclude = setunion(local.ou_accounts_to_exclude, var.exclude_accounts)
163163

164164
# switch cases for various user provided accounts configuration to be onboarded
165165
deployment_account_options = {
166166
NONE = {
167-
accounts_to_deploy = []
167+
accounts_to_deploy = []
168168
account_filter_type = "NONE"
169169
}
170170
UNION = {
171-
accounts_to_deploy = var.include_accounts
171+
accounts_to_deploy = var.include_accounts
172172
account_filter_type = "UNION"
173173
}
174174
DIFFERENCE = {
175-
accounts_to_deploy = local.accounts_to_exclude
175+
accounts_to_deploy = local.accounts_to_exclude
176176
account_filter_type = "DIFFERENCE"
177177
}
178178
MIXED = {
179-
accounts_to_deploy = var.include_accounts
179+
accounts_to_deploy = var.include_accounts
180180
account_filter_type = "UNION"
181181
}
182182
default = {
183183
# default when neither of include/exclude accounts are provided
184-
accounts_to_deploy = []
184+
accounts_to_deploy = []
185185
account_filter_type = "NONE"
186186
}
187187
}
@@ -198,6 +198,6 @@ locals {
198198
# XXX: due to AWS bug of not having UNION filter fully working, there is no way to add those extra accounts requested.
199199
# to not miss out on those extra accounts, deploy the cloud resources across entire org and noop the UNION filter.
200200
# i.e till we can't deploy UNION, we deploy it all
201-
deployment_targets_org_units = local.deployment_targets_accounts.account_filter_type == "UNION" ? local.root_org_unit : local.deployment_targets_ous.org_units_to_deploy
201+
deployment_targets_org_units = local.deployment_targets_accounts.account_filter_type == "UNION" ? local.root_org_unit : local.deployment_targets_ous.org_units_to_deploy
202202
deployment_targets_accounts_filter = local.deployment_targets_accounts.account_filter_type == "UNION" ? "NONE" : local.deployment_targets_accounts.account_filter_type
203-
}
203+
}

modules/agentless-scanning/main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ EOF
124124
}
125125

126126
resource "aws_iam_role_policy_attachments_exclusive" "scanning_stackset_execution_role_managed_policy" {
127-
count = !var.auto_create_stackset_roles ? 0 : 1
128-
role_name = aws_iam_role.scanning_stackset_execution_role[0].id
127+
count = !var.auto_create_stackset_roles ? 0 : 1
128+
role_name = aws_iam_role.scanning_stackset_execution_role[0].id
129129
policy_arns = [
130130
"arn:aws:iam::aws:policy/AWSKeyManagementServicePowerUser",
131131
"arn:aws:iam::aws:policy/AWSCloudFormationFullAccess",
@@ -182,7 +182,7 @@ Resources:
182182
Statement:
183183
- Sid: "Read"
184184
Effect: "Allow"
185-
Action:
185+
Action:
186186
- "ec2:Describe*"
187187
Resource: "*"
188188
Condition:
@@ -273,7 +273,7 @@ Resources:
273273
- Sid: "SysdigAllowKms"
274274
Effect: "Allow"
275275
Principal:
276-
AWS:
276+
AWS:
277277
- "arn:aws:iam::${data.sysdig_secure_agentless_scanning_assets.assets.aws.account_id}:root"
278278
- !GetAtt ScanningRole.Arn
279279
Action:
@@ -288,7 +288,7 @@ Resources:
288288
- Sid: "AllowCustomerManagement"
289289
Effect: "Allow"
290290
Principal:
291-
AWS:
291+
AWS:
292292
- "arn:aws:iam::${local.account_id}:root"
293293
- "${local.caller_arn}"
294294
- "arn:aws:iam::${local.account_id}:role/${local.execution_role_name}"
@@ -310,8 +310,8 @@ TEMPLATE
310310

311311
# stackset instance to deploy resources for agentless scanning, in all regions of given account
312312
resource "aws_cloudformation_stack_set_instance" "primary_acc_stackset_instance" {
313-
for_each = local.region_set
314-
stack_set_instance_region = each.key
313+
for_each = local.region_set
314+
stack_set_instance_region = each.key
315315

316316
stack_set_name = aws_cloudformation_stack_set.primary_acc_stackset.name
317317
operation_preferences {
@@ -365,4 +365,4 @@ resource "sysdig_secure_cloud_auth_account_component" "aws_crypto_key" {
365365
}
366366
}
367367
})
368-
}
368+
}

modules/agentless-scanning/organizational.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Resources:
5959
Statement:
6060
- Sid: "Read"
6161
Effect: "Allow"
62-
Action:
62+
Action:
6363
- "ec2:Describe*"
6464
Resource: "*"
6565
Condition:
@@ -150,7 +150,7 @@ Resources:
150150
- Sid: "SysdigAllowKms"
151151
Effect: "Allow"
152152
Principal:
153-
AWS:
153+
AWS:
154154
- "arn:aws:iam::${data.sysdig_secure_agentless_scanning_assets.assets.aws.account_id}:root"
155155
- !GetAtt ScanningRole.Arn
156156
Action:
@@ -165,7 +165,7 @@ Resources:
165165
- Sid: "AllowCustomerManagement"
166166
Effect: "Allow"
167167
Principal:
168-
AWS:
168+
AWS:
169169
- !Sub "arn:aws:iam::$${AWS::AccountId}:root"
170170
- "${local.caller_arn}"
171171
- !Sub "arn:aws:iam::$${AWS::AccountId}:role/aws-service-role/member.org.stacksets.cloudformation.amazonaws.com/AWSServiceRoleForCloudFormationStackSetsOrgMember"
@@ -188,8 +188,8 @@ resource "aws_cloudformation_stack_set_instance" "ou_stackset_instance" {
188188
"${pair[0]}-${pair[1]}" => pair
189189
} : {}
190190

191-
stack_set_instance_region = each.value[0]
192-
stack_set_name = aws_cloudformation_stack_set.ou_resources_stackset[0].name
191+
stack_set_instance_region = each.value[0]
192+
stack_set_name = aws_cloudformation_stack_set.ou_resources_stackset[0].name
193193
deployment_targets {
194194
organizational_unit_ids = [each.value[1]]
195195
accounts = local.check_old_ouid_param ? null : (local.deployment_targets_accounts_filter == "NONE" ? null : local.deployment_targets_accounts.accounts_to_deploy)

0 commit comments

Comments
 (0)