Skip to content
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
3645bae
feat: scc wp cspm
Apr 30, 2025
f750ad4
fix: update code
Apr 30, 2025
2c8af33
fix: address feedback
May 1, 2025
5135f8a
fix: address feedback
May 1, 2025
663df47
fix: address feedback
May 1, 2025
3b7e1ac
Merge branch 'main' into app-config
jor2 May 5, 2025
6c71bdc
fix: address feedback
May 5, 2025
30b6fbf
fix: address feedback
May 5, 2025
8c9275a
fix: address feedback
May 5, 2025
fa21b71
fix: address feedback
May 5, 2025
661199a
fix: address feedback
May 5, 2025
f6a2bfc
fix: address feedback
May 7, 2025
e09e149
Merge branch 'main' into app-config
jor2 May 12, 2025
b690bcf
fix: add mappings
May 12, 2025
fee0271
fix: add mappings
May 12, 2025
9609e2b
fix: add mappings
May 12, 2025
25f8383
fix: add mappings
May 12, 2025
eabca7d
fix: add mappings
May 12, 2025
75c8a13
fix: add mappings
May 12, 2025
2f9a129
fix: add mappings
May 12, 2025
d8fc41f
fix: add mappings
May 12, 2025
9e167f9
fix: add mappings
May 12, 2025
bba7274
fix: address feedback
May 13, 2025
2563884
fix: address feedback
May 13, 2025
65e39ba
Merge branch 'main' into app-config
jor2 May 14, 2025
151c3e1
fix: address feedback
May 14, 2025
856b7e5
fix: address feedback
May 14, 2025
f0277b8
fix: update code
May 16, 2025
9a5d627
Merge branch 'main' into app-config
jor2 May 19, 2025
17fe1a6
Merge branch 'main' into app-config
jor2 May 21, 2025
562cac3
fix: update examples
May 21, 2025
5259f3a
fix: update examples
May 21, 2025
75f9b6f
fix: update examples
May 21, 2025
41a3268
fix: update examples
May 21, 2025
527972f
fix: update examples
May 21, 2025
4143ce2
fix: update examples
May 21, 2025
26a9a7c
fix: update examples
May 21, 2025
e87069b
fix: update examples
May 21, 2025
df39929
SKIP UPGRADE TEST
May 21, 2025
dff1f40
UNSKIP UPGRADE TEST
May 22, 2025
f92e055
fix: tests
May 22, 2025
d565f74
fix: tests
May 22, 2025
c887d7a
fix: tests
May 22, 2025
812cc15
fix: tests
May 22, 2025
ab2802d
fix: address feedback
May 22, 2025
a7204d6
fix: address feedback
May 22, 2025
912f8b7
fix: address feedback
May 22, 2025
395d050
fix: address feedback
May 22, 2025
05050d7
fix: address feedback
May 23, 2025
625a544
fix: address feedback
May 23, 2025
9453aaa
fix: address feedback
May 23, 2025
26a4c3d
fix: address feedback
May 23, 2025
ee3777a
fix: address feedback
May 23, 2025
501b777
fix: address feedback
May 23, 2025
3c4560a
update addon config
ocofaigh May 23, 2025
76fc804
fix
ocofaigh May 23, 2025
f0901c6
clean
ocofaigh May 23, 2025
891730e
use public RC
ocofaigh May 23, 2025
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ unless real values don't help users know what to change.
-->

```hcl
data "ibm_iam_auth_token" "auth_token" {}

provider "restapi" {
uri = "https://resource-controller.cloud.ibm.com" # https://private.resource-controller.cloud.ibm.com for private
headers = {
Authorization = data.ibm_iam_auth_token.auth_token.iam_access_token
}
write_returns_object = true
}

module "scc_wp" {
source = "terraform-ibm-modules/scc-workload-protection/ibm"
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
Expand All @@ -52,6 +62,7 @@ module "scc_wp" {
resource_group_id = "65xxxxxxxxxxxxxxxa3fd"
resource_key_tags = ["scc-wp-tag"]
cloud_monitoring_instance_crn = "crn:v1:bluemix:public:sysdig-monitor:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX::"
app_config_crn = "crn:v1:bluemix:public:apprap:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX::"
}
```

Expand Down Expand Up @@ -88,12 +99,14 @@ statement instead the previous block.
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.70.0, <2.0.0 |
| <a name="requirement_restapi"></a> [restapi](#requirement\_restapi) | >=1.20.0, <2.0.0 |

### Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_cbr_rule"></a> [cbr\_rule](#module\_cbr\_rule) | terraform-ibm-modules/cbr/ibm//modules/cbr-rule-module | 1.31.0 |
| <a name="module_trusted_profile_scc_wp"></a> [trusted\_profile\_scc\_wp](#module\_trusted\_profile\_scc\_wp) | terraform-ibm-modules/trusted-profile/ibm | 3.0.0 |

### Resources

Expand All @@ -102,27 +115,32 @@ statement instead the previous block.
| [ibm_resource_instance.scc_wp](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_instance) | resource |
| [ibm_resource_key.scc_wp_resource_key](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_key) | resource |
| [ibm_resource_tag.scc_wp_access_tag](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_tag) | resource |
| [restapi_object.cspm](https://registry.terraform.io/providers/Mastercard/restapi/latest/docs/resources/object) | resource |

### Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_access_tags"></a> [access\_tags](#input\_access\_tags) | A list of access tags to apply to the SCC WP instance created by the module. For more information, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial. | `list(string)` | `[]` | no |
| <a name="input_app_config_crn"></a> [app\_config\_crn](#input\_app\_config\_crn) | The CRN of an existing App Config instance to use with the SCC Workload Protection instance. Required if `cspm_enabled` is true. NOTE: Ensure the App Config instance has configuration aggregator enabled. | `string` | `null` | no |
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | The list of context-based restriction rules to create. | <pre>list(object({<br/> description = string<br/> account_id = string<br/> tags = optional(list(object({<br/> name = string<br/> value = string<br/> })), [])<br/> rule_contexts = list(object({<br/> attributes = optional(list(object({<br/> name = string<br/> value = string<br/> }))) }))<br/> enforcement_mode = string<br/> }))</pre> | `[]` | no |
| <a name="input_cloud_monitoring_instance_crn"></a> [cloud\_monitoring\_instance\_crn](#input\_cloud\_monitoring\_instance\_crn) | The CRN of an IBM Cloud Monitoring instance to connect to the SCC Workload Protection instance. | `string` | `null` | no |
| <a name="input_cspm_enabled"></a> [cspm\_enabled](#input\_cspm\_enabled) | Enable Cloud Security Posture Management (CSPM) for the Workload Protection instance. This will create a trusted profile associated with the SCC Workload Protection instance that has viewer / reader access to the App Config service and viewer access to the Enterprise service. | `bool` | `true` | no |
| <a name="input_name"></a> [name](#input\_name) | The name to give the SCC Workload Protection instance that will be provisioned by this module. | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | IBM Cloud region where all resources will be deployed | `string` | `"us-south"` | no |
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where resources will be provisioned. | `string` | n/a | yes |
| <a name="input_resource_key_name"></a> [resource\_key\_name](#input\_resource\_key\_name) | The name to give the IBM Cloud SCC WP resource key. | `string` | `"SCCWPManagerKey"` | no |
| <a name="input_resource_key_tags"></a> [resource\_key\_tags](#input\_resource\_key\_tags) | Tags associated with the IBM Cloud SCC WP resource key. | `list(string)` | `[]` | no |
| <a name="input_resource_tags"></a> [resource\_tags](#input\_resource\_tags) | Optional list of tags to be added to created SCC WP instance. | `list(string)` | `[]` | no |
| <a name="input_scc_workload_protection_trusted_profile_name"></a> [scc\_workload\_protection\_trusted\_profile\_name](#input\_scc\_workload\_protection\_trusted\_profile\_name) | The name to give the trusted profile that is created by this module if `cspm_enabled` is `true. Must begin with a letter.` | `string` | `"workload-protection-trusted-profile"` | no |
| <a name="input_scc_wp_service_plan"></a> [scc\_wp\_service\_plan](#input\_scc\_wp\_service\_plan) | IBM service pricing plan. | `string` | `"free-trial"` | no |

### Outputs

| Name | Description |
|------|-------------|
| <a name="output_access_key"></a> [access\_key](#output\_access\_key) | Workload Protection instance access key. |
| <a name="output_account_id"></a> [account\_id](#output\_account\_id) | Account ID of created SCC WP instance. |
| <a name="output_api_endpoint"></a> [api\_endpoint](#output\_api\_endpoint) | API endpoint. |
| <a name="output_crn"></a> [crn](#output\_crn) | CRN of created SCC WP instance. |
| <a name="output_guid"></a> [guid](#output\_guid) | GUID of created SCC WP instance. |
Expand Down
34 changes: 27 additions & 7 deletions examples/advanced/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,38 @@ module "cbr_zone" {
}]
}

########################################################################################################################
# App Config
########################################################################################################################

# Create new App Config instance
module "app_config" {
source = "terraform-ibm-modules/app-configuration/ibm"
version = "1.5.1"
region = var.region
resource_group_id = module.resource_group.resource_group_id
app_config_plan = "basic"
app_config_name = "${var.prefix}-app-config"
app_config_tags = var.resource_tags
enable_config_aggregator = true
config_aggregator_trusted_profile_name = "${var.prefix}-app-config-tp"
}

########################################################################################################################
# SCC WP instance
########################################################################################################################

module "scc_wp" {
source = "../.."
name = var.prefix
region = var.region
resource_group_id = module.resource_group.resource_group_id
resource_tags = var.resource_tags
access_tags = var.access_tags
cloud_monitoring_instance_crn = module.cloud_monitoring.crn
source = "../.."
name = var.prefix
region = var.region
resource_group_id = module.resource_group.resource_group_id
resource_tags = var.resource_tags
access_tags = var.access_tags
cloud_monitoring_instance_crn = module.cloud_monitoring.crn
cspm_enabled = true
app_config_crn = module.app_config.app_config_crn
scc_workload_protection_trusted_profile_name = "${var.prefix}-wp-tp"

cbr_rules = [
{
Expand Down
11 changes: 11 additions & 0 deletions examples/advanced/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
}

data "ibm_iam_auth_token" "auth_token" {}

# Null resource replaced with restapi_object to enable CSPM
provider "restapi" {
uri = "https://resource-controller.cloud.ibm.com"
headers = {
Authorization = data.ibm_iam_auth_token.auth_token.iam_access_token
}
write_returns_object = true
}
4 changes: 4 additions & 0 deletions examples/advanced/version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ terraform {
source = "ibm-cloud/ibm"
version = ">=1.70.0, <2.0.0"
}
restapi = {
source = "Mastercard/restapi"
version = ">=1.20.0, <2.0.0"
}
}
}
1 change: 1 addition & 0 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ module "scc_wp" {
resource_group_id = module.resource_group.resource_group_id
resource_tags = var.resource_tags
access_tags = var.access_tags
cspm_enabled = false
}
11 changes: 11 additions & 0 deletions examples/basic/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
}

data "ibm_iam_auth_token" "auth_token" {}

# Null resource replaced with restapi_object to enable CSPM
provider "restapi" {
uri = "https://resource-controller.cloud.ibm.com"
headers = {
Authorization = data.ibm_iam_auth_token.auth_token.iam_access_token
}
write_returns_object = true
}
6 changes: 5 additions & 1 deletion examples/basic/version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ terraform {
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
ibm = {
source = "ibm-cloud/ibm"
version = "1.70.0"
version = "1.76.1"
}
restapi = {
source = "Mastercard/restapi"
version = "1.20.0"
}
}
}
56 changes: 31 additions & 25 deletions examples/enterprise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,52 @@

> Only supported in an enterprise account.

This example demonstrates the full deployment of:
This example demonstrates a full deployment using modular Terraform code, including:

- IBM Cloud App Configuration
- IBM Cloud Security and Compliance Center Workload Protection (SCC-WP)
- IAM Trusted Profile Template with 3 Trusted Profiles
- Template assignment to account groups
- Configuration Aggregator to link SCC-WP with App Config
- **IBM Cloud App Configuration** (App Config)
- **IBM Cloud Security and Compliance Center Workload Protection** (SCC-WP)
- **IAM Trusted Profiles** for secure integration
- **Resource Group** creation or reuse
- **Configuration Aggregator** to link SCC-WP with App Config

---

## Flow Overview
## Module Overview

- **Resource Group Module**
Creates or reuses a resource group for all resources.

- **SCC Workload Protection Module**
Deploys the SCC-WP instance, attaches tags, and (optionally) enables CSPM and trusted profiles based on input variables.

- **App Config Module**
Deploys an App Config instance with enterprise plan, tags, and enables the configuration aggregator with a trusted profile.

1. **Create or reuse a resource group**
A resource group is created or reused.
---

## Flow Overview

2. **Deploy App Config**
App Config is deployed along with a collection for organizing features and properties.
1. **Resource Group**
A resource group is created or reused for all resources.

3. **Deploy SCC Workload Protection**
SCC-WP is deployed with the `graduated-tier` plan.
2. **App Config**
Deploys App Config with the enterprise plan, tags, and enables the configuration aggregator with a trusted profile.

4. **Create a Trusted Profile Template with 3 profiles**
- **App Config -- Enterprise**
For IAM template management across the enterprise.
- **App Config -- General**
For reading platform and IAM services.
- **SCC-WP Profile**
For integrating SCC-WP with App Config and enterprise usage.
3. **SCC Workload Protection**
Deploys SCC-WP with the `graduated-tier` plan, attaches resource and access tags, and (optionally) enables CSPM and trusted profiles for secure integration.

5. **Assign the template to account groups**
All child accounts or specific account groups receive the profile template.
4. **Trusted Profiles**
Trusted profiles are created and linked as needed for App Config and SCC-WP, with enterprise access policies conditionally included if enabled.

6. **Create SCC-WP Config Aggregator**
The aggregator connects SCC-WP to App Config and uses the enterprise trusted profile and template ID to enforce secure access.
5. **Configuration Aggregator**
Connects SCC-WP to App Config using the trusted profile and template ID for secure access across the enterprise.

---

## Notes

- The `trusted_profile_links` block in each trusted profile is used to **link the profile to a specific CRN**, like a VSI or App Config instance, enabling the identity to assume the trusted profile.
- The `trusted_profile_links` block in each trusted profile links the profile to a specific CRN (e.g., VSI or App Config instance), enabling the identity to assume the trusted profile.
- Enterprise-specific access policies are conditionally added based on input variables (e.g., `enterprise_enabled`).

---

Expand Down
Loading