Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSPROD-48664 - update(org): include/exclude optional fields #35

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions modules/onboarding/organizational.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "aws_cloudformation_stack_set" "stackset" {
name = local.onboarding_role_name
tags = var.tags
permission_model = "SERVICE_MANAGED"
capabilities = ["CAPABILITY_NAMED_IAM"]
capabilities = ["CAPABILITY_NAMED_IAM"]

managed_execution {
active = true
Expand Down Expand Up @@ -88,7 +88,10 @@ resource "aws_cloudformation_stack_set_instance" "stackset_instance" {
}

resource "sysdig_secure_organization" "aws_organization" {
count = var.is_organizational ? 1 : 0
management_account_id = sysdig_secure_cloud_auth_account.cloud_auth_account.id
organizational_unit_ids = var.organizational_unit_ids
count = var.is_organizational ? 1 : 0
management_account_id = sysdig_secure_cloud_auth_account.cloud_auth_account.id
included_organizational_groups = var.include_ouids
excluded_organizational_groups = var.exclude_ouids
included_cloud_accounts = var.include_accounts
excluded_cloud_accounts = var.exclude_accounts
}
30 changes: 24 additions & 6 deletions modules/onboarding/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ variable "is_organizational" {
description = "true/false whether secure-for-cloud should be deployed in an organizational setup (all accounts of org) or not (only on default aws provider account)"
}

variable "organizational_unit_ids" {
description = "restrict onboarding to a set of organizational unit identifiers whose child accounts and organizational units are to be onboarded. Default: onboard all organizational units"
type = set(string)
default = []
}

variable "region" {
type = string
default = ""
Expand Down Expand Up @@ -51,4 +45,28 @@ variable "is_gov_cloud_onboarding" {
type = bool
default = false
description = "true/false whether secure-for-cloud should be deployed in a govcloud account/org or not"
}

variable "include_ouids" {
description = "(Optional) ouids to include for organization"
type = set(string)
default = []
}

variable "exclude_ouids" {
description = "(Optional) ouids to exclude for organization"
type = set(string)
default = []
}

variable "include_accounts" {
description = "(Optional) accounts to include for organization"
type = set(string)
default = []
}

variable "exclude_accounts" {
description = "(Optional) accounts to exclude for organization"
type = set(string)
default = []
}
5 changes: 3 additions & 2 deletions modules/onboarding/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ terraform {
source = "hashicorp/random"
version = ">= 3.1"
}
# TODO: testing only, update when TF provider is released
sysdig = {
source = "sysdiglabs/sysdig"
version = "~> 1.39"
source = "local/sysdiglabs/sysdig"
version = "~> 1.0.0"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions test/examples/organization/onboarding_with_cspm.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
terraform {
required_providers {
# TODO: testing only, update when TF provider is released
sysdig = {
source = "sysdiglabs/sysdig"
version = "~> 1.38"
source = "local/sysdiglabs/sysdig"
version = "~> 1.0.0"
}
}
}
Expand Down