Skip to content

Commit 3192feb

Browse files
authored
feat: created fscloud profile submodule (#53)
1 parent fa0b08e commit 3192feb

File tree

17 files changed

+323
-93
lines changed

17 files changed

+323
-93
lines changed

.secrets.baseline

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"exclude": {
3-
"files": "go.sum|^.secrets.baseline$",
3+
"files": "go.sum|^.secrets.baseline$|^../.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2024-03-11T11:41:39Z",
6+
"generated_at": "2024-03-25T22:08:26Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -76,18 +76,7 @@
7676
"name": "TwilioKeyDetector"
7777
}
7878
],
79-
"results": {
80-
"README.md": [
81-
{
82-
"hashed_secret": "33da8d0e8af2efc260f01d8e5edfcc5c5aba44ad",
83-
"is_secret": true,
84-
"is_verified": false,
85-
"line_number": 34,
86-
"type": "Secret Keyword",
87-
"verified_result": null
88-
}
89-
]
90-
},
79+
"results": {},
9180
"version": "0.13.1+ibm.62.dss",
9281
"word_list": {
9382
"file": null,

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ This module is used to provision and configure an IBM Cloud [Secrets Manager](ht
1515
<!-- BEGIN OVERVIEW HOOK -->
1616
## Overview
1717
* [terraform-ibm-secrets-manager](#terraform-ibm-secrets-manager)
18+
* [Submodules](./modules)
19+
* [fscloud](./modules/fscloud)
1820
* [Examples](./examples)
1921
* [Basic example](./examples/basic)
2022
* [Complete example with BYOK encryption](./examples/complete)
21-
* [Complete example with private only instance and KYOK encryption](./examples/complete-private)
23+
* [Financial Services Cloud profile example with KYOK encryption](./examples/fscloud)
2224
* [Contributing](#contributing)
2325
<!-- END OVERVIEW HOOK -->
2426

@@ -31,9 +33,10 @@ This module is used to provision and configure an IBM Cloud [Secrets Manager](ht
3133

3234
```hcl
3335
provider "ibm" {
34-
ibmcloud_api_key = "XXXXXXXXXXXXXX"
36+
ibmcloud_api_key = "XXXXXXXXXXXXXX" # pragma: allowlist secret
3537
region = "us-south"
3638
}
39+
3740
module "secrets_manager" {
3841
source = "terraform-ibm-modules/secrets-manager/ibm"
3942
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release

cra-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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/fscloud" # 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).
77
# 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.
88
# 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"
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_existing_kms_instance_guid: "e6dce284-e80f-46e1-a3c1-830f7adff7a9" # hpcs_south
11+
TF_VAR_kms_key_crn: "crn:v1:bluemix:public:hs-crypto:us-south:a/abac0df06b644a9cabc6e44f55b3880e:e6dce284-e80f-46e1-a3c1-830f7adff7a9:key:76170fae-4e0c-48c3-8ebe-326059ebb533" # hpcs_south_root_key_crn

examples/complete-private/README.md

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

examples/complete-private/version.tf

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

examples/fscloud/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Financial Services Cloud profile example with KYOK encryption
2+
3+
An end-to-end example that uses the [Profile for IBM Cloud Framework for Financial Services](https://github.com/terraform-ibm-modules/terraform-ibm-secrets-manager/tree/main/modules/fscloud) to deploy a private only Secrets-Manager instance with KYOK encryption
4+
5+
This examples handles the provisioning of Secrets-Manager instance, the IAM engine configuration in the recently created instance and a context-based restriction (CBR) rule to only allow Secret Manager to be accessible from within the VPC..
6+
7+
Only private service endpoints are enabled, public are disabled. Secrets Manager instances that are private only do not offer a UI management experience.
8+
The example uses the IBM Cloud Terraform provider to create the following infrastructure:
9+
10+
- A resource group, if one is not passed in.
11+
- A sample virtual private cloud (VPC).
12+
- A sample event notification service.
13+
- A secrets manager instance.
14+
- A context-based restriction (CBR) rule to only allow Secrets Manager to be accessible from within the VPC.
15+
16+
:exclamation: **Important:** In this example, only the IBM Secrets Manager instance complies with the IBM Cloud Framework for Financial Services. Other parts of the infrastructure do not necessarily comply.
17+
18+
## Before you begin
19+
20+
- You need a Hyper Protect Crypto Services instance and root key available.

examples/complete-private/main.tf renamed to examples/fscloud/main.tf

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
module "resource_group" {
2-
source = "terraform-ibm-modules/resource-group/ibm"
3-
version = "1.1.5"
4-
# if an existing resource group is not set (null) create a new one using prefix
5-
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
6-
existing_resource_group_name = var.resource_group
2+
source = "terraform-ibm-modules/resource-group/ibm"
3+
version = "1.1.4"
4+
resource_group_name = var.existing_resource_group == false ? var.resource_group : null
5+
existing_resource_group_name = var.existing_resource_group == true ? var.resource_group : null
76
}
87

98
##############################################################################
@@ -16,7 +15,7 @@ data "ibm_iam_account_settings" "iam_account_settings" {
1615
##############################################################################
1716
# VPC
1817
##############################################################################
19-
resource "ibm_is_vpc" "example_vpc" {
18+
resource "ibm_is_vpc" "vpc" {
2019
name = "${var.prefix}-vpc"
2120
resource_group = module.resource_group.resource_group_id
2221
tags = var.resource_tags
@@ -27,31 +26,39 @@ resource "ibm_is_vpc" "example_vpc" {
2726
##############################################################################
2827
module "cbr_zone" {
2928
source = "terraform-ibm-modules/cbr/ibm//modules/cbr-zone-module"
30-
version = "1.19.1"
31-
name = "${var.prefix}-VPC-network-zone"
29+
version = "1.18.0"
30+
name = "${var.prefix}-CBR-zone"
3231
zone_description = "CBR Network zone representing VPC"
3332
account_id = data.ibm_iam_account_settings.iam_account_settings.account_id
3433
addresses = [{
3534
type = "vpc", # to bind a specific vpc to the zone
36-
value = ibm_is_vpc.example_vpc.crn,
35+
value = ibm_is_vpc.vpc.crn,
3736
}]
3837
}
3938

39+
module "event_notification" {
40+
source = "terraform-ibm-modules/event-notifications/ibm"
41+
version = "1.0.4"
42+
resource_group_id = module.resource_group.resource_group_id
43+
name = "${var.prefix}-en"
44+
tags = var.resource_tags
45+
plan = "lite"
46+
service_endpoints = "public"
47+
region = var.region
48+
}
4049

4150
module "secrets_manager" {
42-
source = "../.."
51+
source = "../../modules/fscloud"
4352
resource_group_id = module.resource_group.resource_group_id
4453
region = var.region
4554
secrets_manager_name = "${var.prefix}-secrets-manager" #tfsec:ignore:general-secrets-no-plaintext-exposure
46-
sm_service_plan = var.sm_service_plan
4755
sm_tags = var.resource_tags
48-
service_endpoints = "private"
49-
kms_encryption_enabled = var.kms_encryption_enabled
5056
existing_kms_instance_guid = var.existing_kms_instance_guid
5157
kms_key_crn = var.kms_key_crn
58+
existing_en_instance_crn = module.event_notification.crn
5259
cbr_rules = [
5360
{
54-
description = "${var.prefix}-Secrets Manager access only from vpc"
61+
description = "${var.prefix}-secrets-manager access only from vpc"
5562
enforcement_mode = "enabled"
5663
account_id = data.ibm_iam_account_settings.iam_account_settings.account_id
5764
rule_contexts = [{
File renamed without changes.
File renamed without changes.

examples/complete-private/variables.tf renamed to examples/fscloud/variables.tf

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ variable "prefix" {
99
description = "Prefix for sm instance"
1010
default = "secrets-manager-test"
1111
}
12-
variable "sm_service_plan" {
13-
type = string
14-
description = "Secrets-Manager Trial plan"
15-
default = "trial"
16-
}
1712

1813
variable "region" {
1914
type = string
2015
description = "Region where resources will be created"
21-
default = "us-east"
16+
default = "us-south"
17+
}
18+
19+
variable "existing_resource_group" {
20+
type = bool
21+
description = "Whether to use an existing resource group."
22+
default = false
2223
}
2324

2425
variable "resource_group" {
2526
type = string
26-
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
27-
default = null
27+
description = "A resource group name to use for this example, if `existing_resource_group` is false a new resource group will be created"
28+
default = "sm-fscloud"
2829
}
2930

3031
variable "resource_tags" {
@@ -33,20 +34,16 @@ variable "resource_tags" {
3334
default = []
3435
}
3536

36-
variable "kms_encryption_enabled" {
37-
type = bool
38-
description = "Optional flag to enable KMS encryption"
39-
default = false
40-
}
37+
##############################################################################
38+
# Key Management Service (KMS)
39+
##############################################################################
4140

4241
variable "existing_kms_instance_guid" {
4342
type = string
44-
description = "GUID of the KMS instance containing the key to use for encryption"
45-
default = null
43+
description = "The GUID of the Hyper Protect Crypto Services instance in which the key specified in `kms_key_crn` is coming from."
4644
}
4745

4846
variable "kms_key_crn" {
4947
type = string
50-
description = "CRN of the KMS key to use for encryption"
51-
default = null
48+
description = "The root key CRN of Hyper Protect Crypto Services (HPCS) that you want to use for encryption."
5249
}

0 commit comments

Comments
 (0)