Skip to content

Commit 8b84293

Browse files
authored
fix: added instance id support to the target_service_details variable in the fscloud profile (#275)
1 parent 71bd929 commit 8b84293

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

examples/fscloud/main.tf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ module "resource_group" {
1010
existing_resource_group_name = var.resource_group
1111
}
1212

13+
##############################################################################
14+
# Key Protect Instance
15+
##############################################################################
16+
resource "ibm_resource_instance" "key_protect_instance" {
17+
name = "${var.prefix}-key-protect-instance"
18+
resource_group_id = module.resource_group.resource_group_id
19+
service = "kms"
20+
plan = "tiered-pricing"
21+
location = var.region
22+
service_endpoints = "private"
23+
}
24+
1325
# ##############################################################################
1426
# # Get Cloud Account ID
1527
# ##############################################################################
@@ -63,6 +75,7 @@ module "cbr_account_level" {
6375
target_service_details = {
6476
"kms" = {
6577
"enforcement_mode" = "enabled"
78+
"instance_id" = ibm_resource_instance.key_protect_instance.guid
6679
}
6780
}
6881

@@ -98,7 +111,7 @@ module "cbr_account_level" {
98111
## A zone used to group operator machine ips.
99112
module "cbr_zone_operator_ips" {
100113
source = "../../modules/cbr-zone-module"
101-
name = "List of operator environment public IPs"
114+
name = "${var.prefix}-List of operator environment public IPs"
102115
account_id = data.ibm_iam_account_settings.iam_account_settings.account_id
103116
zone_description = "Zone grouping list of known public ips for operator machines"
104117
addresses = [{
@@ -107,7 +120,7 @@ module "cbr_zone_operator_ips" {
107120
}]
108121
}
109122

110-
## Examples of data lookup on objects (zone, rule) created by the fscoud profile module
123+
## Examples of data lookup on objects (zone, rule) created by the fscloud profile module
111124
## Get rule targetting "event-notification"
112125
data "ibm_cbr_rule" "event_notification_rule" {
113126
rule_id = module.cbr_account_level.map_target_service_rule_ids["event-notifications"].rule_id

modules/fscloud/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Important: In order to avoid unexpected breakage in the account against which th
5252
| <a name="input_existing_serviceref_zone"></a> [existing\_serviceref\_zone](#input\_existing\_serviceref\_zone) | Provide a valid service reference and existing zone id | <pre>map(object(<br> {<br> zone_id = string<br> }))</pre> | `{}` | no |
5353
| <a name="input_prefix"></a> [prefix](#input\_prefix) | Prefix to append to all vpc\_zone\_list, service\_ref\_zone\_list and cbr\_rule\_description created by this submodule | `string` | n/a | yes |
5454
| <a name="input_skip_specific_services_for_zone_creation"></a> [skip\_specific\_services\_for\_zone\_creation](#input\_skip\_specific\_services\_for\_zone\_creation) | Provide a list of service references for which zone creation is not required | `list(string)` | `[]` | no |
55-
| <a name="input_target_service_details"></a> [target\_service\_details](#input\_target\_service\_details) | Details of the target service for which a rule is created. The key is the service name. | <pre>map(object({<br> target_rg = optional(string)<br> enforcement_mode = string<br> tags = optional(list(string))<br> }))</pre> | `{}` | no |
55+
| <a name="input_target_service_details"></a> [target\_service\_details](#input\_target\_service\_details) | Details of the target service for which a rule is created. The key is the service name. | <pre>map(object({<br> target_rg = optional(string)<br> instance_id = optional(string)<br> enforcement_mode = string<br> tags = optional(list(string))<br> }))</pre> | `{}` | no |
5656
| <a name="input_zone_service_ref_list"></a> [zone\_service\_ref\_list](#input\_zone\_service\_ref\_list) | (List) Service reference for the zone creation | `list(string)` | <pre>[<br> "cloud-object-storage",<br> "codeengine",<br> "containers-kubernetes",<br> "databases-for-cassandra",<br> "databases-for-elasticsearch",<br> "databases-for-enterprisedb",<br> "databases-for-etcd",<br> "databases-for-mongodb",<br> "databases-for-mysql",<br> "databases-for-postgresql",<br> "databases-for-redis",<br> "directlink",<br> "iam-groups",<br> "is",<br> "messagehub",<br> "messages-for-rabbitmq",<br> "schematics",<br> "secrets-manager",<br> "server-protect",<br> "user-management",<br> "apprapp",<br> "compliance",<br> "event-notifications"<br>]</pre> | no |
5757
| <a name="input_zone_vpc_crn_list"></a> [zone\_vpc\_crn\_list](#input\_zone\_vpc\_crn\_list) | (List) VPC CRN for the zones | `list(string)` | n/a | yes |
5858

modules/fscloud/main.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,21 @@ module "cbr_rule" {
321321
operator = "stringEquals",
322322
value = each.value.target_rg
323323
},
324+
{
325+
name = "serviceName",
326+
operator = "stringEquals",
327+
value = each.key
328+
}] : try(each.value.instance_id, null) != null ? [
329+
{
330+
name = "accountId",
331+
operator = "stringEquals",
332+
value = data.ibm_iam_account_settings.iam_account_settings.account_id
333+
},
334+
{
335+
name = "serviceInstance",
336+
operator = "stringEquals",
337+
value = each.value.instance_id
338+
},
324339
{
325340
name = "serviceName",
326341
operator = "stringEquals",

modules/fscloud/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ variable "custom_rule_contexts_by_service" {
109109
variable "target_service_details" {
110110
type = map(object({
111111
target_rg = optional(string)
112+
instance_id = optional(string)
112113
enforcement_mode = string
113114
tags = optional(list(string))
114115
}))

0 commit comments

Comments
 (0)