Skip to content

Commit f4b4157

Browse files
authored
feat: The service_credential_names input has been renamed to resource_keys. It now supports creating multiple keys with different roles and allows you to specify the endpoint to use. It also now supports the "NONE" role type. See below for sample usage.<br>- The service_credentials_json and service_credentials_object outputs have been replaced by a resource_keys output. (#472)
1 parent 1bc9777 commit f4b4157

File tree

24 files changed

+205
-241
lines changed

24 files changed

+205
-241
lines changed

.secrets.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-10-07T09:32:06Z",
6+
"generated_at": "2025-10-27T07:44:08Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ You need the following permissions to run this module.
154154
| <a name="input_quotas"></a> [quotas](#input\_quotas) | Quotas to be applied to the Event Streams instance. Entity may be 'default' to apply to all users, or an IAM ServiceID for a specific user. Rates are bytes/second, with -1 meaning no quota. | <pre>list(object({<br/> entity = string<br/> producer_byte_rate = optional(number, -1)<br/> consumer_byte_rate = optional(number, -1)<br/> }))</pre> | `[]` | no |
155155
| <a name="input_region"></a> [region](#input\_region) | The region where the Event Streams instance is created. | `string` | `"us-south"` | no |
156156
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the Event Streams instance is created. | `string` | n/a | yes |
157+
| <a name="input_resource_keys"></a> [resource\_keys](#input\_resource\_keys) | A list of service credential resource keys to be created for the Event Streams instance. | <pre>list(object({<br/> name = string<br/> key_name = optional(string, null)<br/> role = optional(string, "Manager")<br/> endpoint = optional(string, "public")<br/> }))</pre> | `[]` | no |
157158
| <a name="input_schema_global_rule"></a> [schema\_global\_rule](#input\_schema\_global\_rule) | Schema global compatibility rule. Allowed values are 'NONE', 'FULL', 'FULL\_TRANSITIVE', 'FORWARD', 'FORWARD\_TRANSITIVE', 'BACKWARD', 'BACKWARD\_TRANSITIVE'. | `string` | `null` | no |
158159
| <a name="input_schemas"></a> [schemas](#input\_schemas) | The list of schema objects. Include the `schema_id` and the `type` and `name` of the schema in the `schema` object. | <pre>list(object(<br/> {<br/> schema_id = string<br/> schema = object({<br/> type = string<br/> name = string<br/> fields = optional(list(object({<br/> name = string<br/> type = string<br/> })))<br/> })<br/> }<br/> ))</pre> | `[]` | no |
159-
| <a name="input_service_credential_names"></a> [service\_credential\_names](#input\_service\_credential\_names) | The mapping of names and roles for service credentials that you want to create for the Event streams. | `map(string)` | `{}` | no |
160160
| <a name="input_service_endpoints"></a> [service\_endpoints](#input\_service\_endpoints) | The type of service endpoints. Possible values: 'public', 'private', 'public-and-private'. | `string` | `"public"` | no |
161161
| <a name="input_skip_es_s2s_iam_authorization_policy"></a> [skip\_es\_s2s\_iam\_authorization\_policy](#input\_skip\_es\_s2s\_iam\_authorization\_policy) | Set to true to skip the creation of an IAM authorization policy that will allow all Event Streams instances in the given resource group access to read from the mirror source instance. This policy is required when creating a mirroring instance, and will only be created if a value is passed in the mirroring input. | `bool` | `false` | no |
162162
| <a name="input_skip_kms_iam_authorization_policy"></a> [skip\_kms\_iam\_authorization\_policy](#input\_skip\_kms\_iam\_authorization\_policy) | Set to true to skip the creation of an IAM authorization policy that permits all Event Streams database instances in the resource group to read the encryption key from the KMS instance. If set to false, pass in a value for the KMS instance in the `kms_key_crn` variable. In addition, no policy is created if var.kms\_encryption\_enabled is set to false. | `bool` | `false` | no |
@@ -178,8 +178,7 @@ You need the following permissions to run this module.
178178
| <a name="output_kafka_http_url"></a> [kafka\_http\_url](#output\_kafka\_http\_url) | The API endpoint to interact with Event Streams REST API |
179179
| <a name="output_mirroring_config_id"></a> [mirroring\_config\_id](#output\_mirroring\_config\_id) | The ID of the mirroring config in CRN format |
180180
| <a name="output_mirroring_topic_patterns"></a> [mirroring\_topic\_patterns](#output\_mirroring\_topic\_patterns) | Mirroring topic patterns |
181-
| <a name="output_service_credentials_json"></a> [service\_credentials\_json](#output\_service\_credentials\_json) | The service credentials JSON map. |
182-
| <a name="output_service_credentials_object"></a> [service\_credentials\_object](#output\_service\_credentials\_object) | The service credentials object. |
181+
| <a name="output_resource_keys"></a> [resource\_keys](#output\_resource\_keys) | List of resource keys |
183182
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
184183
<!-- BEGIN CONTRIBUTING HOOK -->
185184

examples/complete/main.tf

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,19 @@ module "event_streams" {
6060
]
6161
metrics = []
6262
quotas = []
63-
service_credential_names = {
64-
"es_writer" : "Writer",
65-
"es_reader" : "Reader",
66-
"es_manager" : "Manager"
67-
}
63+
64+
resource_keys = [
65+
{
66+
name = "${var.prefix}-writer-key"
67+
role = "Writer"
68+
},
69+
{
70+
name = "${var.prefix}-reader-key"
71+
role = "Reader"
72+
},
73+
{
74+
name = "${var.prefix}-manager-key"
75+
role = "Manager"
76+
}
77+
]
6878
}

examples/complete/outputs.tf

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,8 @@ output "kafka_broker_version" {
3636
value = module.event_streams.kafka_broker_version
3737
}
3838

39-
output "service_credentials_json" {
40-
description = "Service credentials json map"
41-
value = module.event_streams.service_credentials_json
42-
sensitive = true
43-
}
44-
45-
output "service_credentials_object" {
46-
description = "Service credentials object"
47-
value = module.event_streams.service_credentials_object
39+
output "resource_keys" {
40+
description = "List of resource keys"
41+
value = module.event_streams.resource_keys
4842
sensitive = true
4943
}

examples/fscloud/main.tf

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,25 @@ module "event_streams" {
117117
}
118118
]
119119
schema_global_rule = "FORWARD"
120-
service_credential_names = {
121-
"es_writer" : "Writer",
122-
"es_reader" : "Reader",
123-
"es_manager" : "Manager"
124-
}
120+
121+
resource_keys = [
122+
{
123+
name = "${var.prefix}-writer-key"
124+
role = "Writer"
125+
endpoint = "private"
126+
},
127+
{
128+
name = "${var.prefix}-reader-key"
129+
role = "Reader"
130+
endpoint = "private"
131+
},
132+
{
133+
name = "${var.prefix}-manager-key"
134+
role = "Manager"
135+
endpoint = "private"
136+
}
137+
]
138+
125139
cbr_rules = [
126140
{
127141
description = "${var.prefix}-event streams access from vpc and schematics"

examples/fscloud/outputs.tf

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,11 @@ output "kafka_http_url" {
3232
value = module.event_streams.kafka_http_url
3333
}
3434

35-
output "service_credentials_json" {
36-
description = "Service credentials json map"
37-
value = module.event_streams.service_credentials_json
35+
output "resource_keys" {
36+
description = "List of resource keys"
37+
value = module.event_streams.resource_keys
3838
sensitive = true
3939
}
40-
41-
output "service_credentials_object" {
42-
description = "Service credentials object"
43-
value = module.event_streams.service_credentials_object
44-
sensitive = true
45-
}
46-
4740
output "mirroring_config_id" {
4841
description = "The ID of the mirroring config in CRN format"
4942
value = module.event_streams.mirroring_config_id

ibm_catalog.json

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,18 @@
245245
"key": "skip_event_streams_secrets_manager_auth_policy"
246246
},
247247
{
248-
"key": "service_credential_names"
248+
"key": "resource_keys",
249+
"type": "array",
250+
"custom_config": {
251+
"type": "code_editor",
252+
"grouping": "deployment",
253+
"original_grouping": "deployment",
254+
"config_constraints": {
255+
"supportedLanguages": [
256+
"hcl"
257+
]
258+
}
259+
}
249260
},
250261
{
251262
"key": "existing_secrets_manager_endpoint_type",
@@ -739,7 +750,18 @@
739750
"key": "skip_event_streams_secrets_manager_auth_policy"
740751
},
741752
{
742-
"key": "service_credential_names"
753+
"key": "resource_keys",
754+
"type": "array",
755+
"custom_config": {
756+
"type": "code_editor",
757+
"grouping": "deployment",
758+
"original_grouping": "deployment",
759+
"config_constraints": {
760+
"supportedLanguages": [
761+
"hcl"
762+
]
763+
}
764+
}
743765
},
744766
{
745767
"key": "existing_secrets_manager_endpoint_type",

main.tf

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -226,24 +226,13 @@ module "cbr_rule" {
226226
}
227227

228228
resource "ibm_resource_key" "service_credentials" {
229-
for_each = var.service_credential_names
230-
name = each.key
231-
role = each.value
229+
for_each = { for key in var.resource_keys : key.name => key }
230+
name = each.value.key_name == null ? each.key : each.value.key_name
231+
role = each.value.role
232232
resource_instance_id = ibm_resource_instance.es_instance.id
233-
}
234-
235-
locals {
236-
service_credentials_json = length(var.service_credential_names) > 0 ? {
237-
for service_credential in ibm_resource_key.service_credentials :
238-
service_credential["name"] => service_credential["credentials_json"]
239-
} : null
240-
241-
service_credentials_object = length(var.service_credential_names) > 0 ? {
242-
credentials = {
243-
for service_credential in ibm_resource_key.service_credentials :
244-
service_credential["name"] => service_credential["credentials"]
245-
}
246-
} : null
233+
parameters = {
234+
service-endpoints = each.value.endpoint
235+
}
247236
}
248237

249238
resource "ibm_event_streams_mirroring_config" "es_mirroring_config" {

modules/fscloud/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ No resources.
3939
| <a name="input_quotas"></a> [quotas](#input\_quotas) | Quotas to be applied to the Event Streams instance. Entity may be 'default' to apply to all users, or an IAM ServiceID for a specific user. Rates are bytes/second, with -1 meaning no quota. | <pre>list(object({<br/> entity = string<br/> producer_byte_rate = optional(number, -1)<br/> consumer_byte_rate = optional(number, -1)<br/> }))</pre> | `[]` | no |
4040
| <a name="input_region"></a> [region](#input\_region) | The region where the Event Streams are created. | `string` | `"us-south"` | no |
4141
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the Event Streams instance is created. | `string` | n/a | yes |
42+
| <a name="input_resource_keys"></a> [resource\_keys](#input\_resource\_keys) | A list of service credential resource keys to be created for the Event Streams instance. | <pre>list(object({<br/> name = string<br/> role = optional(string, "Reader")<br/> endpoint = optional(string, "private")<br/> }))</pre> | `[]` | no |
4243
| <a name="input_schema_global_rule"></a> [schema\_global\_rule](#input\_schema\_global\_rule) | Schema global compatibility rule. Allowed values are 'NONE', 'FULL', 'FULL\_TRANSITIVE', 'FORWARD', 'FORWARD\_TRANSITIVE', 'BACKWARD', 'BACKWARD\_TRANSITIVE'. | `string` | `null` | no |
4344
| <a name="input_schemas"></a> [schemas](#input\_schemas) | The list of schema objects. Include the `schema_id` and the `type` and `name` of the schema in the `schema` object. | <pre>list(object(<br/> {<br/> schema_id = string<br/> schema = object({<br/> type = string<br/> name = string<br/> fields = optional(list(object({<br/> name = string<br/> type = string<br/> })))<br/> })<br/> }<br/> ))</pre> | `[]` | no |
44-
| <a name="input_service_credential_names"></a> [service\_credential\_names](#input\_service\_credential\_names) | The mapping of names and roles for service credentials that you want to create for the Event streams. | `map(string)` | `{}` | no |
4545
| <a name="input_skip_es_s2s_iam_authorization_policy"></a> [skip\_es\_s2s\_iam\_authorization\_policy](#input\_skip\_es\_s2s\_iam\_authorization\_policy) | Set to true to skip the creation of an Event Streams s2s IAM authorization policy to provision an Event Streams mirroring instance. This is required to read from the source cluster. This policy is required when creating mirroring instance. | `bool` | `false` | no |
4646
| <a name="input_skip_kms_iam_authorization_policy"></a> [skip\_kms\_iam\_authorization\_policy](#input\_skip\_kms\_iam\_authorization\_policy) | Set to true to skip the creation of an IAM authorization policy that permits all Event Streams database instances in the resource group to read the encryption key from the KMS instance. If set to false, pass in a value for the KMS instance in the kms\_key\_crn variable. In addition, no policy is created if var.kms\_encryption\_enabled is set to false. | `bool` | `false` | no |
4747
| <a name="input_tags"></a> [tags](#input\_tags) | The list of tags associated with the Event Streams instance. | `list(string)` | `[]` | no |
@@ -60,6 +60,5 @@ No resources.
6060
| <a name="output_kafka_http_url"></a> [kafka\_http\_url](#output\_kafka\_http\_url) | The API endpoint to interact with Event Streams REST API |
6161
| <a name="output_mirroring_config_id"></a> [mirroring\_config\_id](#output\_mirroring\_config\_id) | The ID of the mirroring config in CRN format |
6262
| <a name="output_mirroring_topic_patterns"></a> [mirroring\_topic\_patterns](#output\_mirroring\_topic\_patterns) | Mirroring topic patterns |
63-
| <a name="output_service_credentials_json"></a> [service\_credentials\_json](#output\_service\_credentials\_json) | Service credentials json map |
64-
| <a name="output_service_credentials_object"></a> [service\_credentials\_object](#output\_service\_credentials\_object) | Service credentials object |
63+
| <a name="output_resource_keys"></a> [resource\_keys](#output\_resource\_keys) | List of resource keys |
6564
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

modules/fscloud/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module "event_streams" {
1414
topics = var.topics
1515
service_endpoints = "private"
1616
cbr_rules = var.cbr_rules
17-
service_credential_names = var.service_credential_names
17+
resource_keys = var.resource_keys
1818
metrics = var.metrics
1919
quotas = var.quotas
2020
kms_encryption_enabled = true

0 commit comments

Comments
 (0)