Skip to content

Commit f6c2934

Browse files
authored
fix: fixed icd-apitypes for global deny rule (#522)
1 parent f33bc88 commit f6c2934

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

examples/fscloud/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ module "cbr_account_level" {
8787
"enforcement_mode" = "enabled"
8888
"global_deny" = false # mandatory to set 'global_deny = false' when no scope is defined
8989
}
90+
"databases-for-postgresql" = {
91+
"enforcement_mode" = "enabled"
92+
"target_rg" = module.resource_group.resource_group_id
93+
}
9094
"messagehub" = {
9195
# As the service is scoped, a new global rule will also get created
9296
"enforcement_mode" = "enabled"

modules/fscloud/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,17 @@ module "global_deny_cbr_rule" {
448448
rule_description = try(each.value.description, null) != null ? each.value.description : "${var.prefix}-${each.key}-global-deny-rule"
449449
enforcement_mode = each.value.enforcement_mode
450450
rule_contexts = []
451-
451+
operations = (length(lookup(local.operations_apitype_val, each.key, [])) > 0) ? [{
452+
api_types = [
453+
# lookup the map for the target service name, if empty then pass default value
454+
for apitype in lookup(local.operations_apitype_val, each.key, []) : {
455+
api_type_id = apitype
456+
}]
457+
}] : [{
458+
api_types = [{
459+
api_type_id = "crn:v1:bluemix:public:context-based-restrictions::::api-type:"
460+
}]
461+
}]
452462
resources = [{
453463
tags = try(each.value.tags, null) != null ? [for tag in each.value.tags : {
454464
name = split(":", tag)[0]

0 commit comments

Comments
 (0)