Skip to content

Commit

Permalink
fix: fixed icd-apitypes for global deny rule (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ak-sky authored Sep 5, 2024
1 parent f33bc88 commit f6c2934
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions examples/fscloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ module "cbr_account_level" {
"enforcement_mode" = "enabled"
"global_deny" = false # mandatory to set 'global_deny = false' when no scope is defined
}
"databases-for-postgresql" = {
"enforcement_mode" = "enabled"
"target_rg" = module.resource_group.resource_group_id
}
"messagehub" = {
# As the service is scoped, a new global rule will also get created
"enforcement_mode" = "enabled"
Expand Down
12 changes: 11 additions & 1 deletion modules/fscloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,17 @@ module "global_deny_cbr_rule" {
rule_description = try(each.value.description, null) != null ? each.value.description : "${var.prefix}-${each.key}-global-deny-rule"
enforcement_mode = each.value.enforcement_mode
rule_contexts = []

operations = (length(lookup(local.operations_apitype_val, each.key, [])) > 0) ? [{
api_types = [
# lookup the map for the target service name, if empty then pass default value
for apitype in lookup(local.operations_apitype_val, each.key, []) : {
api_type_id = apitype
}]
}] : [{
api_types = [{
api_type_id = "crn:v1:bluemix:public:context-based-restrictions::::api-type:"
}]
}]
resources = [{
tags = try(each.value.tags, null) != null ? [for tag in each.value.tags : {
name = split(":", tag)[0]
Expand Down

0 comments on commit f6c2934

Please sign in to comment.