File tree Expand file tree Collapse file tree 4 files changed +42
-15
lines changed
examples/multi-service-profile Expand file tree Collapse file tree 4 files changed +42
-15
lines changed Original file line number Diff line number Diff line change @@ -36,21 +36,23 @@ locals {
3636 ]
3737 }] : []
3838
39- service_ref_zone_list = (length (var. zone_service_ref_list ) > 0 ) ? [{
40- name = " ${ var . prefix } -cbr-serviceref-zone"
41- account_id = data.ibm_iam_account_settings.iam_account_settings.account_id
42- zone_description = " cbr-serviceref-zone-terraform"
43- # when the target service is containers-kubernetes or any icd services, context cannot have a serviceref
44- addresses = [
45- for serviceref in var . zone_service_ref_list : {
46- type = " serviceRef"
47- ref = {
48- account_id = data.ibm_iam_account_settings.iam_account_settings.account_id
49- service_name = serviceref
39+ service_ref_zone_list = (length (var. zone_service_ref_list ) > 0 ) ? [
40+ for serviceref in var . zone_service_ref_list : {
41+ name = " ${ var . prefix } -${ serviceref } -cbr-serviceref-zone"
42+ account_id = data . ibm_iam_account_settings . iam_account_settings . account_id
43+ zone_description = " ${ serviceref } -cbr-serviceref-zone-terraform"
44+ # when the target service is containers-kubernetes or any icd services, context cannot have a serviceref
45+ addresses = [
46+ {
47+ type = " serviceRef"
48+ ref = {
49+ account_id = data.ibm_iam_account_settings.iam_account_settings.account_id
50+ service_name = serviceref
51+ }
5052 }
51- }
52- ]
53+ ]
5354 }] : []
55+
5456 zone_list = concat (tolist (local. vpc_zone_list ), tolist (local. service_ref_zone_list ))
5557}
5658
@@ -68,7 +70,7 @@ locals {
6870 attributes = [
6971 {
7072 " name" : " endpointType" ,
71- " value" : " private "
73+ " value" : join ( " , " , ([ for endpoint in var . endpoints : endpoint ]))
7274 },
7375 {
7476 name = " networkZoneId"
Original file line number Diff line number Diff line change @@ -60,3 +60,15 @@ variable "target_service_details" {
6060 error_message = " Provide a valid target service name that is supported by context-based restrictions"
6161 }
6262}
63+
64+ variable "endpoints" {
65+ type = list (string )
66+ description = " List specific endpoint types for target services, valid values for endpoints are 'public', 'private' or 'direct'"
67+ default = [" private" ]
68+ validation {
69+ condition = alltrue ([
70+ for endpoint in var . endpoints : can (regex (" ^(public|private|direct)$" , endpoint))
71+ ])
72+ error_message = " Valid values for endpoints are 'public', 'private' or 'direct'"
73+ }
74+ }
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ locals {
5151 # Merge zone ids to pass as contexts to the rule
5252 target_services_details = [
5353 {
54- target_service_name = " kms " ,
54+ target_service_name = " secrets-manager " ,
5555 target_rg = module.resource_group.resource_group_id
5656 enforcement_mode = local.enforcement_mode
5757 }
@@ -63,4 +63,5 @@ module "cbr_rule_multi_service_profile" {
6363 zone_service_ref_list = var. zone_service_ref_list
6464 zone_vpc_crn_list = local. zone_vpc_crn_list
6565 target_service_details = local. target_services_details
66+ endpoints = var. endpoints
6667}
Original file line number Diff line number Diff line change @@ -33,3 +33,15 @@ variable "zone_service_ref_list" {
3333 default = [" cloud-object-storage" , " containers-kubernetes" , " server-protect" ]
3434 description = " (List) Service reference for the zone creation"
3535}
36+
37+ variable "endpoints" {
38+ type = list (string )
39+ description = " List specific endpoint types for target services, valid values for endpoints are 'public', 'private' or 'direct'"
40+ default = [" private" ]
41+ validation {
42+ condition = alltrue ([
43+ for endpoint in var . endpoints : can (regex (" ^(public|private|direct)$" , endpoint))
44+ ])
45+ error_message = " Valid values for endpoints are 'public', 'private' or 'direct'"
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments