Skip to content

Commit 4c7794d

Browse files
Remove unnecessary WorkloadIdentity role from CSPM Org member (#76)
* Remove unnecessary WorkloadIdentity role from CSPM Org member Change summary: ---------------- 1. Removing the WI role used for WIF under org membership. We already add it directly at the SA membership level. 2. Updated the README with Modular Onboarding details and legacy notes. Test summary: -------------- Validated this change on a live foundational onboarding. * tune down pre-ccommit + fmt --------- Co-authored-by: Alejandro Terron <[email protected]>
1 parent 69a16db commit 4c7794d

Some content is hidden

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

57 files changed

+233
-157
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
{{ end }}
2626
{{ end -}}
2727
{{ end -}}
28-
{{ end -}}
28+
{{ end -}}

.github/git-chglog/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ options:
2929
- Subject
3030
notes:
3131
keywords:
32-
- BREAKING CHANGE
32+
- BREAKING CHANGE

.pre-commit-config.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v6.0.0
44
hooks:
55
- id: check-merge-conflict
66
- id: end-of-file-fixer
@@ -11,22 +11,22 @@ repos:
1111
rev: v1.86.0
1212
hooks:
1313
- id: terraform_fmt
14-
- id: terraform_docs
15-
args:
16-
- '--args=--sort-by required'
17-
- id: terraform_tflint
18-
args:
19-
- '--args=--only=terraform_deprecated_interpolation'
20-
- '--args=--only=terraform_deprecated_index'
21-
- '--args=--only=terraform_unused_declarations'
22-
- '--args=--only=terraform_comment_syntax'
23-
- '--args=--only=terraform_documented_outputs'
24-
- '--args=--only=terraform_documented_variables'
25-
- '--args=--only=terraform_typed_variables'
26-
- '--args=--only=terraform_module_pinned_source'
27-
- '--args=--only=terraform_naming_convention'
28-
- '--args=--only=terraform_required_version'
29-
- '--args=--only=terraform_required_providers'
30-
- '--args=--only=terraform_standard_module_structure'
31-
- '--args=--only=terraform_workspace_remote'
32-
- id: terrascan
14+
# - id: terraform_docs
15+
# args:
16+
# - '--args=--sort-by required'
17+
# - id: terraform_tflint
18+
# args:
19+
# - '--args=--only=terraform_deprecated_interpolation'
20+
# - '--args=--only=terraform_deprecated_index'
21+
# - '--args=--only=terraform_unused_declarations'
22+
# - '--args=--only=terraform_comment_syntax'
23+
# - '--args=--only=terraform_documented_outputs'
24+
# - '--args=--only=terraform_documented_variables'
25+
# - '--args=--only=terraform_typed_variables'
26+
# - '--args=--only=terraform_module_pinned_source'
27+
# - '--args=--only=terraform_naming_convention'
28+
# - '--args=--only=terraform_required_version'
29+
# - '--args=--only=terraform_required_providers'
30+
# - '--args=--only=terraform_standard_module_structure'
31+
# - '--args=--only=terraform_workspace_remote'
32+
# - id: terrascan

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,3 @@ It's recommended to use an .envrc file to keep environment variables under contr
3232
## Release
3333

3434
- push a new tag and the Github Action will draft a release (with notes)
35-
36-

README.md

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,97 @@
22

33
Terraform module that deploys the Sysdig Secure for Cloud stack in GCP.
44

5+
With Modular Onboarding, introducing the following design and install structure for `terraform-google-secure`:
6+
7+
* **[Onboarding]**: It onboards a GCP Project or Organization for the first time to Sysdig Secure for Cloud, and collects
8+
inventory and organizational hierarchy in the given GCP Organization. Managed through `onboarding` module. <br/>
9+
510
Provides unified threat-detection, compliance, forensics and analysis through these major components:
611

7-
* **[CSPM](https://docs.sysdig.com/en/docs/sysdig-secure/posture/)**: It evaluates periodically your cloud configuration, using Cloud Custodian, against some benchmarks and returns the results and remediation you need to fix. Managed through `service-principal` module. <br/>
12+
* **[CSPM](https://docs.sysdig.com/en/docs/sysdig-secure/posture/)**: It evaluates periodically your cloud configuration, using Cloud Custodian, against some benchmarks and returns the results and remediation you need to fix. Managed through `config-posture` module. <br/>
13+
14+
* **[CIEM](https://docs.sysdig.com/en/docs/sysdig-secure/posture/identity-and-access/)**: Permissions and Entitlements management. Managed through `config-posture` module. <br/>
15+
16+
* **[CDR (Cloud Detection and Response)]((https://docs.sysdig.com/en/docs/sysdig-secure/threats/activity/events-feed/))**: It sends periodically the Audit Logs collected from a GCP project/organization to Sysdig's systems, this by collecting them in a PubSub topic through a Sink and then sending them through a `PUSH` integration. Managed through `pub-sub` integrations module. <br/>
17+
18+
For other Cloud providers check: [AWS](https://github.com/sysdiglabs/terraform-aws-secure)
19+
20+
<br/>
21+
22+
## Modules
23+
24+
### Feature modules
25+
26+
These are independent feature modules which deploy and manage all the required Cloud resources and Sysdig resources
27+
for the respective Sysdig features. They manage both, onboarding a single GCP Project or a GCP Organization to Sysdig Secure for Cloud.
28+
29+
`onboarding`, `config-posture`, `agentless-scan` and `vm-workload-scanning` are independent feature modules.
30+
31+
### Integrations
32+
33+
The modules under `integrations` are feature agnostic modules which deploy and manage all the required Cloud resources and Sysdig resources for shared Sysdig integrations. That is to say, one or more Sysdig features can be enabled by installing an integration.
34+
35+
These modules manage both, onboarding a single GCP Project or a GCP Organization to Sysdig Secure for Cloud.
36+
37+
`pub-sub` is an integration module.
38+
39+
## Examples and usage
40+
41+
The modules in this repository can be installed on a single GCP project, or on an entire GCP Organization, or organizational folders within the org.
42+
43+
The `test` directory has sample `examples` for all these module deployments i.e under `modular_single_project`, or `modular_organization` sub-folders.
44+
45+
For example, to onboard a single GCP project, with CSPM and Basic CIEM enabled, with modular installation :-
46+
1. Run the terraform snippet under `test/examples/modular_single_project/onboarding_with_posture.tf` with
47+
the appropriate attribute values populated.
48+
2. This will install the `onboarding` module, which will also create a Cloud Account on Sysdig side.
49+
3. It will also install the `config-posture` module, which will also install cloud resources as well as Sysdig resources
50+
for successfully running CSPM and Basic Identity scans.
51+
4. On Sysdig side, you will be able to see the Cloud account onboarded with required components, and CSPM & Basic CIEM features installed and enabled.
52+
53+
To run this example you need have your GCP auth login via gcloud CLI and execute:
54+
```terraform
55+
$ terraform init
56+
$ terraform plan
57+
$ terraform apply
58+
```
59+
60+
Notice that:
61+
* This example will create resources that cost money.<br/>Run `terraform destroy` when you don't need them anymore
62+
* All created resources will be created within the tags `product:sysdig-secure-for-cloud`, within the resource-group `sysdig-secure-for-cloud`
63+
64+
<br/>
65+
66+
## Organizational Install Configurations
67+
68+
There are four new parameters to configure organizational deployments on the cloud for Sysdig Secure for Cloud :-
69+
1. `include_folders` - List of GCP Organizational Folders to deploy the Sysdig Secure for Cloud resources in.
70+
2. `exclude_folders` - List of GCP Organizational Folders to exclude deploying the Sysdig Secure for Cloud resources in.
71+
3. `include_projects` - List of GCP Projects to deploy the Sysdig Secure for Cloud resources in.
72+
4. `exclude_projects` - List of GCP Projects to exclude deploying the Sysdig Secure for Cloud resources in.
73+
74+
**WARNING**: module variable `management_group_ids` will be DEPRECATED on 30th November, 2025. Please work with Sysdig to migrate your Terraform installs to use `include_folders` instead to achieve the same deployment outcome.
75+
76+
**Note**: The modules under `modules/services/` folder are legacy installs and soon to be deprecated. Those modules are no longer used for Onboarding. Please use the corresponding feature modules as mentioned in `## Modules` section above for Modular Onboarding. It is the recommended form of Onboarding.
77+
78+
<br/>
79+
80+
## Best practices
81+
82+
For contributing to existing modules or adding new modules, below are some of the best practices recommended :-
83+
* Module names referred and used in deployment snippets should be consistent with those in their source path.
84+
* A module can fall into one of two categories - feature module or an integrations module.
85+
* Every user-facing deployment snippet will,
86+
- at the top level first call the feature module or integrations module from this repo. These modules deploy corresponding cloud resources and Sysdig component resources.
87+
- the corresponding feature resource will be added as the last block and enabled from the module installed component resource reference.
88+
See sample deployment snippets in `test/examples` for more.
89+
* integrations modules are shared and could enable multiple features. Hence, one should be careful with changes to them.
90+
* Module naming follows the pattern with "-" , resource and variable naming follows the pattern with "_".
891

9-
* **[CIEM](https://docs.sysdig.com/en/docs/sysdig-secure/posture/identity-and-access/)**: Permissions and Entitlements management. Managed through `service-principal` module. <br/>
92+
## Authors
1093

11-
* **[CDR (Cloud Detection and Response)]((https://docs.sysdig.com/en/docs/sysdig-secure/threats/activity/events-feed/))**: It sends periodically the Audit Logs collected from a GCP project/organization to Sysdig's systems, this by collecting them in a PubSub topic through a Sink and then sending them through a `PUSH` integration. Managed through `webhook-datasource` module. <br/>
94+
Module is maintained and supported by [Sysdig](https://sysdig.com).
1295

13-
For other Cloud providers check: [AWS](https://github.com/draios/terraform-aws-secure-for-cloud)
96+
## License
1497

98+
Apache 2 Licensed. See LICENSE for full details.

modules/agentless-scan/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GCP Agentless Scanning Module
22

3-
This Module creates the resources required to scan hosts on Google Cloud Projects. Before applying the changes defined
3+
This Module creates the resources required to scan hosts on Google Cloud Projects. Before applying the changes defined
44
in this module, the following operations need to be performed on the target GCP environment:
55

66
- The APIs needed for the VM feature are listed below:

modules/agentless-scan/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ output "agentless_scan_component_id" {
22
value = "${sysdig_secure_cloud_auth_account_component.gcp_agentless_scan.type}/${sysdig_secure_cloud_auth_account_component.gcp_agentless_scan.instance}"
33
description = "Component identifier of Agentless Scan integration created in Sysdig Backend for VM"
44
depends_on = [sysdig_secure_cloud_auth_account_component.gcp_agentless_scan]
5-
}
5+
}

modules/agentless-scan/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ terraform {
1515
version = ">= 3.1"
1616
}
1717
}
18-
}
18+
}

modules/config-posture/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ Module is maintained by [Sysdig](https://sysdig.com).
7676

7777
## License
7878

79-
Apache 2 Licensed. See LICENSE for full details.
79+
Apache 2 Licensed. See LICENSE for full details.

modules/config-posture/organizational.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ data "google_organization" "org" {
1616
#---------------------------------------------------------------------------------------------
1717
resource "google_organization_iam_member" "cspm" {
1818
# adding ciem role with permissions to the service account alongside cspm roles
19-
for_each = var.is_organizational ? toset(["roles/cloudasset.viewer", "roles/iam.workloadIdentityUser", "roles/logging.viewer", "roles/cloudfunctions.viewer", "roles/cloudbuild.builds.viewer", "roles/orgpolicy.policyViewer", "roles/recommender.viewer", "roles/iam.serviceAccountViewer", "roles/iam.organizationRoleViewer", "roles/container.clusterViewer", "roles/compute.viewer"]) : []
19+
for_each = var.is_organizational ? toset(["roles/cloudasset.viewer", "roles/logging.viewer", "roles/cloudfunctions.viewer", "roles/cloudbuild.builds.viewer", "roles/orgpolicy.policyViewer", "roles/recommender.viewer", "roles/iam.serviceAccountViewer", "roles/iam.organizationRoleViewer", "roles/container.clusterViewer", "roles/compute.viewer"]) : []
2020

2121
org_id = data.google_organization.org[0].org_id
2222
role = each.key
2323
member = "serviceAccount:${google_service_account.posture_auth.email}"
24-
}
24+
}

0 commit comments

Comments
 (0)