Skip to content

Commit 5c55830

Browse files
committed
WIP
1 parent 564e73a commit 5c55830

22 files changed

+1045
-2
lines changed

ibm_catalog.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"support_details": "This product is in the community registry, as such support is handled through the originated repo. If you experience issues please open an issue in that repository [https://github.com/terraform-ibm-modules/terraform-ibm-event-notifications/issues](https://github.com/terraform-ibm-modules/terraform-ibm-event-notifications/issues). Please note this product is not supported via the IBM Cloud Support Center.",
4343
"flavors": [
4444
{
45-
"label": "Standard",
45+
"label": "Security-enforced",
4646
"name": "standard",
4747
"install_type": "fullstack",
4848
"working_directory": "solutions/standard",

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###########################################################
2-
# This file creates an event notificaiton resource instance
2+
# This file creates an event notification resource instance
33
###########################################################
44
locals {
55
# tflint-ignore: terraform_unused_declarations
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Configuring complex inputs for Event Notifications in IBM Cloud projects
2+
3+
Several optional input variables in the IBM Cloud [Event Notifications deployable architecture](https://cloud.ibm.com/catalog#deployable_architecture) use complex object types. You specify these inputs when you configure deployable architecture.
4+
5+
* Context-Based Restrictions Rules (`cbr_rules`)
6+
7+
8+
## Rules For Context-Based Restrictions <a name="cbr_rules"></a>
9+
10+
The `cbr_rules` input variable allows you to provide a rule for the target service to enforce access restrictions for the service based on the context of access requests. Contexts are criteria that include the network location of access requests, the endpoint type from where the request is sent, etc.
11+
12+
- Variable name: `cbr_rules`.
13+
- Type: A list of objects. Allows only one object representing a rule for the target service
14+
- Default value: An empty list (`[]`).
15+
16+
### Options for cbr_rules
17+
18+
- `description` (required): The description of the rule to create.
19+
- `account_id` (required): The IBM Cloud Account ID
20+
- `rule_contexts` (required): (List) The contexts the rule applies to
21+
- `attributes` (optional): (List) Individual context attributes
22+
- `name` (required): The attribute name.
23+
- `value`(required): The attribute value.
24+
25+
- `enforcement_mode` (required): The rule enforcement mode can have the following values:
26+
- `enabled` - The restrictions are enforced and reported. This is the default.
27+
- `disabled` - The restrictions are disabled. Nothing is enforced or reported.
28+
- `report` - The restrictions are evaluated and reported, but not enforced.
29+
- `operations` (optional): The operations this rule applies to
30+
- `api_types`(required): (List) The API types this rule applies to.
31+
- `api_type_id`(required):The API type ID
32+
33+
34+
### Example Rule For Context-Based Restrictions Configuration
35+
36+
```hcl
37+
cbr_rules = [
38+
{
39+
description = "Event Notifications can be accessed from xyz"
40+
account_id = "defc0df06b644a9cabc6e44f55b3880s."
41+
rule_contexts= [{
42+
attributes = [
43+
{
44+
"name" : "endpointType",
45+
"value" : "private"
46+
},
47+
{
48+
name = "networkZoneId"
49+
value = "93a51a1debe2674193217209601dde6f" # pragma: allowlist secret
50+
}
51+
]
52+
}
53+
]
54+
enforcement_mode = "enabled"
55+
operations = [{
56+
api_types = [{
57+
api_type_id = "crn:v1:bluemix:public:context-based-restrictions::::api-type:"
58+
}]
59+
}]
60+
}
61+
]
62+
```
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Configuring complex inputs in Event Notifications
2+
3+
Several optional input variables in the IBM Cloud [Event Notifications deployable architecture](https://cloud.ibm.com/catalog/7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3/architecture/deploy-arch-ibm-event-notifications-c7ac3ee6-4f48-4236-b974-b0cd8c624a46-global) use complex object types. You specify these inputs when you configure you deployable architecture.
4+
5+
- [Service credentials](#svc-credential-name) (`service_credential_names`)
6+
- [Service credential secrets](#service-credential-secrets) (`service_credential_secrets`)
7+
8+
## Service credentials <a name="svc-credential-name"></a>
9+
10+
You can specify a set of IAM credentials to connect to the instance with the `service_credential_names` input variable. Include a credential name and IAM service role for each key-value pair. Each role provides a specific level of access to the instance. For more information, see [Adding and viewing credentials](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui). If you want to add service credentials to secret manager and to allow secret manager to manage it, you should use `service_credential_secrets` , see [Service credential secrets](#service-credential-secrets)
11+
12+
- Variable name: `service_credential_names`.
13+
- Type: A map. The key is the name of the service credential. The value is the role that is assigned to that credential.
14+
- Default value: An empty map (`{}`).
15+
16+
### Options for service_credential_names
17+
18+
- Key (required): The name of the service credential.
19+
- Value (required): The IAM service role that is assigned to the credential. The following values are valid for service credential roles: 'Manager', 'Writer', 'Reader', 'Event Source Manager', 'Channel Editor', 'Event Notification Publisher', 'Status Reporter', 'Device Manager', 'Email Sender', 'Custom Email Status Reporter'. For more information, see [IBM Cloud IAM roles](https://cloud.ibm.com/docs/account?topic=account-userroles).
20+
21+
### Example service credentials
22+
23+
```hcl
24+
{
25+
"en_manager" : "Manager",
26+
"en_reader" : "Reader",
27+
"en_writer" : "Writer",
28+
"en_email_sender" : "Email Sender"
29+
}
30+
```
31+
32+
## Service credential secrets <a name="service-credential-secrets"></a>
33+
34+
When you add an IBM Event Notification deployable architecture from the IBM Cloud catalog to IBM Cloud Project, you can configure service credentials. In edit mode for the projects configuration, from the configure panel click the optional tab.
35+
36+
To enter a custom value, use the edit action to open the "Edit Array" panel. Add the service credential secrets configurations to the array here.
37+
38+
In the configuration, specify the secret group name, whether it already exists or will be created and include all the necessary service credential secrets that need to be created within that secret group.
39+
40+
[Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-getting-started#getting-started) about service credential secrets.
41+
42+
- Variable name: `service_credential_secrets`.
43+
- Type: A list of objects that represent service credential secret groups and secrets
44+
- Default value: An empty list (`[]`)
45+
46+
### Options for service_credential_secrets
47+
48+
- `secret_group_name` (required): A unique human-readable name that identifies this service credential secret group.
49+
- `secret_group_description` (optional, default = `null`): A human-readable description for this secret group.
50+
- `existing_secret_group`: (optional, default = `false`): Set to true, if secret group name provided in the variable `secret_group_name` already exists.
51+
- `service_credentials`: (required): A list of object that represents a service credential secret.
52+
53+
#### Options for service_credentials
54+
55+
- `secret_name`: (required): A unique human-readable name of the secret to create.
56+
- `service_credentials_source_service_role_crn`: (required): The CRN of the role to give the service credential in the Event Nofication service. Service credentials role CRNs can be found at https://cloud.ibm.com/iam/roles, select Event Notifications and select the role. Role CRNs can be for the roles `Writer`, `Reader`, `Manager`, `Event Source Manager`, `Channel Editor`, `Event Notification Publisher`, `Status Reporter`, `Device Manager`, `Email Sender`, `Custom Email Status Reporter` , or `Pool ID Manager`
57+
- `secret_labels`: (optional, default = `[]`): Labels of the secret to create. Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not permitted include the angled brackets (<>), comma (,), colon (:), ampersand (&), and vertical pipe character (|).
58+
- `secret_auto_rotation`: (optional, default = `true`): Whether to configure automatic rotation of service credential.
59+
- `secret_auto_rotation_unit`: (optional, default = `day`): Specifies the unit of time for rotation of a secret. Acceptable values are `day` or `month`.
60+
- `secret_auto_rotation_interval`: (optional, default = `89`): Specifies the rotation interval for the rotation unit.
61+
- `service_credentials_ttl`: (optional, default = `7776000`): The time-to-live (TTL) to assign to generated service credentials (in seconds).
62+
- `service_credential_secret_description`: (optional, default = `null`): Description of the secret to create.
63+
64+
The following example includes all the configuration options for four service credentials and two secret groups.
65+
```hcl
66+
[
67+
{
68+
"secret_group_name": "sg-1"
69+
"existing_secret_group": true
70+
"service_credentials": [
71+
{
72+
"secret_name": "cred-1"
73+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer"
74+
"secret_labels": ["test-writer-1", "test-writer-2"]
75+
"secret_auto_rotation": true
76+
"secret_auto_rotation_unit": "day"
77+
"secret_auto_rotation_interval": 89
78+
"service_credentials_ttl": 7776000
79+
"service_credential_secret_description": "sample description"
80+
},
81+
{
82+
"secret_name": "cred-2"
83+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Reader"
84+
}
85+
]
86+
},
87+
{
88+
"secret_group_name": "sg-2"
89+
"service_credentials": [
90+
{
91+
"secret_name": "cred-3"
92+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Editor"
93+
}
94+
]
95+
}
96+
]
97+
```
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Event Notifications solution
2+
3+
When `existing_en_instance_crn` is not passed, this solution configures the following infrastructure:
4+
5+
- optionally a KMS key ring and key for IBM Event Notifications encryption
6+
- optionally a KMS key ring and key for IBM Cloud Object Storage encryption
7+
- optionally an IBM Cloud Object Storage bucket to collect events that fail delivery
8+
- an IBM Event Notifications instance
9+
10+
When `existing_en_instance_crn` is passed, this solution ignores ALL other inputs and sets the outputs based on the CRN.
11+
12+
- required inputs MUST still be set, but will be ignored.
13+
14+
:exclamation: **Important:** This solution is not intended to be called by one or more other modules because it contains a provider configuration and is not compatible with the `for_each`, `count`, and `depends_on` arguments. For more information, see [Providers Within Modules](https://developer.hashicorp.com/terraform/language/modules/develop/providers).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ibmcloud_api_key": $VALIDATION_APIKEY,
3+
"resource_group_name": $PREFIX,
4+
"tags": $TAGS,
5+
"existing_kms_instance_crn": $HPCS_US_SOUTH_CRN,
6+
"kms_endpoint_url": "https://api.private.us-south.hs-crypto.cloud.ibm.com:8992"
7+
}

0 commit comments

Comments
 (0)