Skip to content

Commit 6e64359

Browse files
authored
Update azure_mandatory_sql_subscription_resource_group_mandatory.yaml
1 parent 3789b65 commit 6e64359

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

compliance/controls/azure/azure_mandatory_sql_subscription_resource_group_mandatory.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
12
id: azure_mandatory_sql_subscription_resource_group_mandatory
23
title: Resource groups should have mandatory tags
34
description: Check if Resource groups have mandatory tags.
45
integration_type:
56
- azure_subscription
67
parameters:
78
- key: azureMandatoryTags
8-
value: '["name","environment"]'
9+
value: $global.mandatory_tags
910
policy:
1011
language: sql
1112
primary_resource: azure_resource_group
@@ -16,8 +17,9 @@ policy:
1617
platform_resource_id,
1718
id,
1819
title,
19-
tags ?& '{{.azureMandatoryTags}}'::text[] AS has_mandatory_tags,
20-
TO_JSONB('{{.azureMandatoryTags}}'::text[]) - ARRAY(
20+
-- Use the $global.mandatory_tags reference in the SQL
21+
tags ?& $global.mandatory_tags::text[] AS has_mandatory_tags,
22+
TO_JSONB($global.mandatory_tags::text[]) - ARRAY(
2123
SELECT jsonb_object_keys(tags)
2224
) AS missing_tags,
2325
subscription_id
@@ -37,7 +39,8 @@ policy:
3739
ELSE title || ' is missing tags: ' || array_to_string(
3840
ARRAY(
3941
SELECT jsonb_array_elements_text(missing_tags)
40-
), ', ') || '.'
42+
), ', '
43+
) || '.'
4144
END AS reason,
4245
subscription_id
4346
FROM

0 commit comments

Comments
 (0)