Skip to content

Commit 9f53c9a

Browse files
Revert "Deprecate legacy TF module variables for Folder units (#79)" (#81)
This reverts commit 29d62c9.
1 parent ce3f251 commit 9f53c9a

File tree

6 files changed

+50
-5
lines changed

6 files changed

+50
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ There are four new parameters to configure organizational deployments on the clo
7171
3. `include_projects` - List of GCP Projects to deploy the Sysdig Secure for Cloud resources in.
7272
4. `exclude_projects` - List of GCP Projects to exclude deploying the Sysdig Secure for Cloud resources in.
7373

74-
**DEPRECATION NOTICE**: module variable `management_group_ids` has been DEPRECATED and is no longer supported. Please work with Sysdig to migrate your Terraform installs to use `include_folders` instead to achieve the same deployment outcome.
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.
7575

7676
**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.
7777

modules/onboarding/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ resource |
8181
| <a name="input_organization_domain"></a> [organization\_domain](#input\_organization\_domain) | Organization domain. e.g. sysdig.com | `string` | `""` | no |
8282
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | (Required) Target Project identifier provided by the customer | `string` | n/a | yes |
8383
| <a name="input_suffix"></a> [suffix](#input\_suffix) | (Optional) Suffix to uniquely identify resources during multiple installs. If not provided, random value is autogenerated | `string` | `null` | no |
84+
| <a name="input_management_group_ids"></a> [suffix](#input\_management\_group\_ids) | TO BE DEPRECATED on 30th November, 2025: Please work with Sysdig to migrate to using `include_folders` instead.<br>List of management group ids w.r.t an org install. If not provided, set to empty by default | `set(string)` | `[]` | no |
8485
| <a name="input_include_folders"></a> [suffix](#input\_include\_folders) | folders to include for organization in the format 'folders/{folder_id}'. i.e: folders/123456789012 | `set(string)` | `[]` | no |
8586
| <a name="input_exclude_folders"></a> [suffix](#input\_exclude\_folders) | folders to exclude for organization in the format 'folders/{folder_id}'. i.e: folders/123456789012 | `set(string)` | `[]` | no |
8687
| <a name="input_include_projects"></a> [suffix](#input\_include\_projects) | projects to include for organization. i.e: my-project-id | `set(string)` | `[]` | no |

modules/onboarding/locals.tf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
locals {
2+
# check if both old and new include/exclude org parameters are used, we fail early
3+
both_org_configuration_params = var.is_organizational && length(var.management_group_ids) > 0 && (
4+
length(var.include_folders) > 0 ||
5+
length(var.exclude_folders) > 0 ||
6+
length(var.include_projects) > 0 ||
7+
length(var.exclude_projects) > 0
8+
)
9+
210
# add 'folders/' prefix to the include/exclude folders
311
prefixed_include_folders = [for folder_id in var.include_folders : "folders/${folder_id}"]
412
prefixed_exclude_folders = [for folder_id in var.exclude_folders : "folders/${folder_id}"]
513

14+
# check if old management_group_ids parameter is provided, for backwards compatibility we will always give preference to it
15+
check_old_management_group_ids_param = var.is_organizational && length(var.management_group_ids) > 0
16+
617
# fetch the GCP root org
718
root_org = var.is_organizational ? [data.google_organization.org[0].name] : []
819
}
20+
21+
check "validate_org_configuration_params" {
22+
assert {
23+
condition = length(var.management_group_ids) == 0 # if this condition is false we throw warning
24+
error_message = <<-EOT
25+
WARNING: TO BE DEPRECATED 'management_group_ids' on 30th November, 2025. Please work with Sysdig to migrate your Terraform installs to use 'include_folders' instead.
26+
EOT
27+
}
28+
29+
assert {
30+
condition = !local.both_org_configuration_params # if this condition is false we throw error
31+
error_message = <<-EOT
32+
ERROR: If both management_group_ids and include_folders/exclude_folders/include_projects/exclude_projects variables are populated,
33+
ONLY management_group_ids will be considered. Please use only one of the two methods.
34+
35+
Note: management_group_ids is going to be DEPRECATED 'management_group_ids' on 30th November, 2025. Please work with Sysdig to migrate your Terraform installs.
36+
EOT
37+
}
38+
}

modules/onboarding/organizational.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ resource "sysdig_secure_organization" "google_organization" {
3030
count = var.is_organizational ? 1 : 0
3131

3232
management_account_id = sysdig_secure_cloud_auth_account.google_account.id
33+
organizational_unit_ids = local.check_old_management_group_ids_param ? var.management_group_ids : []
3334
organization_root_id = local.root_org[0]
34-
included_organizational_groups = local.prefixed_include_folders
35-
excluded_organizational_groups = local.prefixed_exclude_folders
36-
included_cloud_accounts = var.include_projects
37-
excluded_cloud_accounts = var.exclude_projects
35+
included_organizational_groups = local.check_old_management_group_ids_param ? [] : local.prefixed_include_folders
36+
excluded_organizational_groups = local.check_old_management_group_ids_param ? [] : local.prefixed_exclude_folders
37+
included_cloud_accounts = local.check_old_management_group_ids_param ? [] : var.include_projects
38+
excluded_cloud_accounts = local.check_old_management_group_ids_param ? [] : var.exclude_projects
3839
automatic_onboarding = var.enable_automatic_onboarding
3940
depends_on = [
4041
google_organization_iam_member.browser,

modules/onboarding/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ variable "organization_domain" {
1515
default = ""
1616
}
1717

18+
variable "management_group_ids" {
19+
description = <<-EOF
20+
TO BE DEPRECATED on 30th November, 2025: Please work with Sysdig to migrate to using `include_folders` instead.
21+
When set, restrict onboarding to a set of folder identifiers whose child projects and projects are to be onboarded. e.g. ["organizations/123456789012"], ["folders/123456789012"]
22+
Default: onboard all folders.
23+
EOF
24+
type = set(string)
25+
default = []
26+
}
27+
1828
variable "suffix" {
1929
type = string
2030
description = "Suffix to uniquely identify resources during multiple installs. If not provided, random value is autogenerated"

test/examples/modular_organization/onboarding_with_posture.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ module "onboarding" {
2323
is_organizational = true
2424
organization_domain = "draios.com"
2525

26+
# legacy include/exclude org install params
27+
# management_group_ids = ["folders/123456789012"]
28+
2629
# include/exclude parameters
2730
include_folders = ["123456789012", "12345678911"]
2831
exclude_folders = []

0 commit comments

Comments
 (0)