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

feat: use existing scc instance #221

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@
"description": "The CRN of an existing event notification instance to use in this solution. If not set, a new event notification instance is provisioned.",
"required": false
},
{
"key": "existing_scc_instance_crn",
"type": "string",
"default_value": "__NULL__",
"description": "The CRN of an existing security and compliance center instance to use in this solution. If not set, a new security and compliance center instance is provisioned.",
"required": false
},
{
"key": "existing_discovery_instance",
"type": "string",
Expand Down
11 changes: 11 additions & 0 deletions solutions/basic/stack_definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@
"hidden": false,
"default": null
},
{
"name": "existing_scc_instance_crn",
"required": false,
"type": "string",
"hidden": false,
"default": null
},
{
"name": "existing_event_notification_instance_crn",
"required": false,
Expand Down Expand Up @@ -384,6 +391,10 @@
"name": "resource_group_name",
"value": "ref:../Account Infrastructure Base/outputs/audit_resource_group_name"
},
{
"name": "existing_scc_instance_crn",
"value": "ref:../../inputs/existing_scc_instance_crn"
},
{
"name": "existing_kms_instance_crn",
"value": "ref:../Essential Security - Encryption Key Management/outputs/kms_instance_crn"
Expand Down
11 changes: 11 additions & 0 deletions solutions/standard/stack_definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@
"hidden": false,
"default": null
},
{
"name": "existing_scc_instance_crn",
"required": false,
"type": "string",
"hidden": false,
"default": null
},
{
"name": "existing_event_notification_instance_crn",
"required": false,
Expand Down Expand Up @@ -384,6 +391,10 @@
"name": "resource_group_name",
"value": "ref:../Account Infrastructure Base/outputs/audit_resource_group_name"
},
{
"name": "existing_scc_instance_crn",
"value": "ref:../../inputs/existing_scc_instance_crn"
},
{
"name": "existing_kms_instance_crn",
"value": "ref:../Essential Security - Encryption Key Management/outputs/kms_instance_crn"
Expand Down
5 changes: 3 additions & 2 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestProjectsBasicExistingResourcesTest(t *testing.T) {
t.Parallel()

// ------------------------------------------------------------------------------------
// Provision RG, EN and SM
// Provision RG, EN, SM, and SCC
// ------------------------------------------------------------------------------------

prefix := fmt.Sprintf("ragext-%s", strings.ToLower(random.UniqueId()))
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestProjectsBasicExistingResourcesTest(t *testing.T) {
} else {

// ------------------------------------------------------------------------------------
// Test passing an existing SM, RG, EN
// Test passing an existing SM, RG, EN, SCC
// ------------------------------------------------------------------------------------

options := testprojects.TestProjectOptionsDefault(&testprojects.TestProjectsOptions{
Expand All @@ -134,6 +134,7 @@ func TestProjectsBasicExistingResourcesTest(t *testing.T) {
"existing_kms_instance_crn": terraform.Output(t, existingTerraformOptions, "kms_instance_crn"),
"existing_event_notification_instance_crn": terraform.Output(t, existingTerraformOptions, "event_notification_instance_crn"),
"en_email_list": []string{"[email protected]"},
"existing_scc_instance_crn": terraform.Output(t, existingTerraformOptions, "crn"),
}

err := options.RunProjectsTest()
Expand Down
34 changes: 34 additions & 0 deletions tests/resources/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,37 @@ module "key_protect_all_inclusive" {
key_ring_endpoint_type = "private"
key_endpoint_type = "private"
}

module "kms_root_key" {
source = "terraform-ibm-modules/kms-key/ibm"
kms_instance_id = module.key_protect_all_inclusive.kms_guid
key_name = "${var.prefix}-kms-root-key"
}

##############################################################################
# Security and Compliance Center
##############################################################################

module "cos" {
source = "terraform-ibm-modules/cos/ibm"
version = "8.15.11"
cos_instance_name = "${var.prefix}-cos"
existing_kms_instance_guid = module.key_protect_all_inclusive.kms_guid
retention_enabled = false
resource_group_id = module.resource_group.resource_group_id
bucket_name = "${var.prefix}-cb"
kms_key_crn = module.kms_root_key.crn
}

module "security_and_compliance_center" {
source = "terraform-ibm-modules/scc/ibm"
version = "1.8.30"
instance_name = "${var.prefix}-scc-instance"
region = var.region
resource_group_id = module.resource_group.resource_group_id
resource_tags = var.resource_tags
cos_bucket = module.cos.bucket_name
cos_instance_crn = module.cos.cos_instance_id
en_instance_crn = module.event_notifications.crn
en_source_name = module.event_notifications.event_notification_instance_name
}