Skip to content

Commit 2683b52

Browse files
authored
feat: initial release (#1)
1 parent 26c9c85 commit 2683b52

File tree

19 files changed

+261
-190
lines changed

19 files changed

+261
-190
lines changed

README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
<!-- Update the title -->
22
# Security and Compliance Center Workload Protection module
33

4-
<!--
5-
Update status and "latest release" badges:
6-
1. For the status options, see https://github.ibm.com/GoldenEye/documentation/blob/master/status.md
7-
2. Update the "latest release" badge to point to the correct module's repo. Replace "module-template" in two places.
8-
-->
9-
[![Incubating (Not yet consumable)](https://img.shields.io/badge/status-Incubating%20(Not%20yet%20consumable)-red)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
10-
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-module-template?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-module-template/releases/latest)
4+
[![Stable (With quality checks)](https://img.shields.io/badge/Status-Stable%20(With%20quality%20checks)-green)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
5+
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-scc-workload-protection?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-scc-workload-protection/releases/latest)
116
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
127
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
138
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
149

1510
<!-- Add a description of module(s) in this repo -->
16-
TODO: Replace me with description of the module(s) in this repo
11+
A module for provisioning an [IBM Cloud Security and Compliance Center Workload Protection instance](https://cloud.ibm.com/docs/workload-protection?topic=workload-protection-getting-started). The module will always create a Manager resource key that connects to the SCC WP instance.
1712

1813

1914
<!-- Below content is automatically populated via pre-commit hook -->
@@ -22,7 +17,6 @@ TODO: Replace me with description of the module(s) in this repo
2217
* [terraform-ibm-scc-workload-protection](#terraform-ibm-scc-workload-protection)
2318
* [Examples](./examples)
2419
* [Basic example](./examples/basic)
25-
* [Complete example](./examples/complete)
2620
* [Contributing](#contributing)
2721
<!-- END OVERVIEW HOOK -->
2822

@@ -49,7 +43,14 @@ unless real values don't help users know what to change.
4943
-->
5044

5145
```hcl
52-
46+
module "scc_wp" {
47+
source = "terraform-ibm-modules/scc-workload-protection/ibm"
48+
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
49+
name = "my-scc-wp-service"
50+
region = "us-south"
51+
resource_group_id = "65xxxxxxxxxxxxxxxa3fd"
52+
resource_key_tags = ["scc-wp-tag"]
53+
}
5354
```
5455

5556
### Required IAM access policies
@@ -89,22 +90,42 @@ statement instead the previous block.
8990
| Name | Version |
9091
|------|---------|
9192
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0, <1.6.0 |
93+
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.58.1, <2.0.0 |
9294

9395
### Modules
9496

9597
No modules.
9698

9799
### Resources
98100

99-
No resources.
101+
| Name | Type |
102+
|------|------|
103+
| [ibm_resource_instance.scc_wp](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_instance) | resource |
104+
| [ibm_resource_key.scc_wp_resource_key](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_key) | resource |
105+
| [ibm_resource_tag.scc_wp_access_tag](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_tag) | resource |
100106

101107
### Inputs
102108

103-
No inputs.
109+
| Name | Description | Type | Default | Required |
110+
|------|-------------|------|---------|:--------:|
111+
| <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 |
112+
| <a name="input_name"></a> [name](#input\_name) | A identifier used as a prefix when naming resources that will be provisioned. Must begin with a letter. | `string` | n/a | yes |
113+
| <a name="input_region"></a> [region](#input\_region) | IBM Cloud region where all resources will be deployed | `string` | `"us-south"` | no |
114+
| <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 |
115+
| <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 |
116+
| <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 |
117+
| <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 |
118+
| <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 |
104119

105120
### Outputs
106121

107-
No outputs.
122+
| Name | Description |
123+
|------|-------------|
124+
| <a name="output_api_endpoint"></a> [api\_endpoint](#output\_api\_endpoint) | API endpoint. |
125+
| <a name="output_crn"></a> [crn](#output\_crn) | CRN of created SCC WP instance. |
126+
| <a name="output_id"></a> [id](#output\_id) | ID of created SCC WP instance. |
127+
| <a name="output_ingestion_endpoint"></a> [ingestion\_endpoint](#output\_ingestion\_endpoint) | Ingestion endpoint. |
128+
| <a name="output_name"></a> [name](#output\_name) | Name of created SCC WP instance. |
108129
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
109130

110131
<!-- Leave this section as is so that your module has a link to local development environment set up steps for contributors to follow -->

cra-config.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# More info about this file at https://github.com/terraform-ibm-modules/common-pipeline-assets/blob/main/.github/workflows/terraform-test-pipeline.md#cra-config-yaml
22
version: "v1"
33
CRA_TARGETS:
4-
- CRA_TARGET: "examples/complete" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
4+
- CRA_TARGET: "examples/basic" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
55
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" # CRA Ignore file to use. If not provided, it checks the repo root directory for `cra-tf-validate-ignore-rules.json`
66
PROFILE_ID: "0e6e7b5a-817d-4344-ab6f-e5d7a9c49520" # SCC profile ID (currently set to the FSCloud 1.4.0 profile).
7-
# SCC_INSTANCE_ID: "" # The SCC instance ID to use to download profile for CRA scan. If not provided, a default global value will be used.
8-
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used.
9-
# CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs.
10-
# TF_VAR_sample: "sample value"
11-
# TF_VAR_other: "another value"

examples/basic/README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# Basic example
22

3-
<!--
4-
The basic example should call the module(s) stored in this repository with a basic configuration.
5-
Note, there is a pre-commit hook that will take the title of each example and include it in the repos main README.md.
6-
The text below should describe exactly what resources are provisioned / configured by the example.
7-
-->
3+
An end-to-end example that uses the module's default variable values. This example uses the IBM Cloud terraform provider to:
84

9-
An end-to-end basic example that will provision the following:
10-
- A new resource group if one is not passed in.
11-
- A new Cloud Object Storage instance.
5+
- Create a new resource group if one is not passed in.
6+
- Create a new Security and Compliance Center Workload Protection instance.

examples/basic/main.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ module "resource_group" {
1111
}
1212

1313
########################################################################################################################
14-
# COS instance
14+
# SCC WP instance
1515
########################################################################################################################
1616

17-
resource "ibm_resource_instance" "cos_instance" {
18-
name = "${var.prefix}-cos"
17+
module "scc_wp" {
18+
source = "../.."
19+
name = var.prefix
20+
region = var.region
1921
resource_group_id = module.resource_group.resource_group_id
20-
service = "cloud-object-storage"
21-
plan = "standard"
22-
location = "global"
23-
tags = var.resource_tags
22+
resource_tags = var.resource_tags
23+
access_tags = var.access_tags
2424
}

examples/basic/outputs.tf

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@
22
# Outputs
33
########################################################################################################################
44

5-
output "cos_instance_id" {
6-
description = "COS instance id"
7-
value = ibm_resource_instance.cos_instance.id
5+
output "id" {
6+
description = "ID of created SCC WP instance."
7+
value = module.scc_wp.id
88
}
99

10-
output "resource_group_name" {
11-
description = "Resource group name"
12-
value = module.resource_group.resource_group_name
10+
output "crn" {
11+
description = "CRN of created SCC WP instance."
12+
value = module.scc_wp.crn
1313
}
1414

15-
output "resource_group_id" {
16-
description = "Resource group ID"
17-
value = module.resource_group.resource_group_id
15+
output "name" {
16+
description = "Name of created SCC WP instance."
17+
value = module.scc_wp.name
18+
}
19+
20+
output "ingestion_endpoint" {
21+
description = "Ingestion endpoint."
22+
value = module.scc_wp.ingestion_endpoint
23+
sensitive = true
24+
}
25+
26+
output "api_endpoint" {
27+
description = "API endpoint."
28+
value = module.scc_wp.api_endpoint
29+
sensitive = true
1830
}

examples/basic/variables.tf

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
1-
########################################################################################################################
2-
# Input variables
3-
########################################################################################################################
41

2+
##############################################################################
3+
# Input Variables
4+
##############################################################################
55
variable "ibmcloud_api_key" {
6+
description = "The IBM Cloud platform API key needed to deploy IAM enabled resources."
67
type = string
7-
description = "The IBM Cloud API Key"
88
sensitive = true
99
}
1010

11-
variable "region" {
11+
variable "prefix" {
12+
description = "Display name of the prefix for related resources"
1213
type = string
13-
description = "Region to provision all resources created by this example"
14-
default = "us-south"
14+
default = "scc-wp"
1515
}
1616

17-
variable "prefix" {
17+
variable "region" {
18+
description = "Name of the Region to deploy into"
1819
type = string
19-
description = "Prefix to append to all resources created by this example"
20-
default = "basic"
20+
default = "us-south"
2121
}
2222

2323
variable "resource_group" {
2424
type = string
25-
description = "The name of an existing resource group to provision resources in to. If not set a new resource group will be created using the prefix variable"
25+
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
2626
default = null
2727
}
2828

29+
2930
variable "resource_tags" {
3031
type = list(string)
3132
description = "Optional list of tags to be added to created resources"
3233
default = []
3334
}
35+
36+
variable "access_tags" {
37+
type = list(string)
38+
description = "Optional list of access management tags to add to the SCC WP instance"
39+
default = []
40+
}

examples/basic/version.tf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
terraform {
22
required_version = ">= 1.3.0, <1.6.0"
3-
4-
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
5-
# module's version.tf (usually a basic example), and 1 example that will always use the latest provider version.
63
required_providers {
4+
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
75
ibm = {
8-
source = "IBM-Cloud/ibm"
9-
version = "1.49.0"
6+
source = "ibm-cloud/ibm"
7+
version = "1.58.1"
108
}
119
}
1210
}

examples/complete/README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/complete/main.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/complete/outputs.tf

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)