Fix org policies factories

This commit is contained in:
Julio Castillo 2022-11-17 17:51:15 +01:00
parent a3767cdfe2
commit b2510ea4cf
5 changed files with 22 additions and 37 deletions

View File

@ -17,14 +17,10 @@
# tfdoc:file:description Folder-level organization policies.
locals {
_factory_data_raw = (
var.org_policies_data_path == null
? tomap({})
: merge([
for f in fileset(var.org_policies_data_path, "*.yaml") :
yamldecode(file("${var.org_policies_data_path}/${f}"))
]...)
)
_factory_data_raw = merge([
for f in try(fileset(var.org_policies_data_path, "*.yaml"), []) :
yamldecode(file("${var.org_policies_data_path}/${f}"))
]...)
# simulate applying defaults to data coming from yaml files
_factory_data = {

View File

@ -15,14 +15,11 @@
*/
locals {
_custom_constraints_factory_data_raw = (
var.org_policy_custom_constraints_data_path == null
? tomap({})
: merge([
for f in fileset(var.org_policy_custom_constraints_data_path, "*.yaml") :
yamldecode(file("${var.org_policy_custom_constraints_data_path}/${f}"))
]...)
)
_custom_constraints_factory_data_raw = merge([
for f in try(fileset(var.org_policy_custom_constraints_data_path, "*.yaml"), []) :
yamldecode(file("${var.org_policy_custom_constraints_data_path}/${f}"))
]...)
_custom_constraints_factory_data = {
for k, v in local._custom_constraints_factory_data_raw :

View File

@ -17,14 +17,10 @@
# tfdoc:file:description Organization-level organization policies.
locals {
_factory_data_raw = (
var.org_policies_data_path == null
? tomap({})
: merge([
for f in fileset(var.org_policies_data_path, "*.yaml") :
yamldecode(file("${var.org_policies_data_path}/${f}"))
]...)
)
_factory_data_raw = merge([
for f in try(fileset(var.org_policies_data_path, "*.yaml"), []) :
yamldecode(file("${var.org_policies_data_path}/${f}"))
]...)
# simulate applying defaults to data coming from yaml files
_factory_data = {

View File

@ -17,14 +17,10 @@
# tfdoc:file:description Project-level organization policies.
locals {
_factory_data_raw = (
var.org_policies_data_path == null
? tomap({})
: merge([
for f in fileset(var.org_policies_data_path, "*.yaml") :
yamldecode(file("${var.org_policies_data_path}/${f}"))
]...)
)
_factory_data_raw = merge([
for f in try(fileset(var.org_policies_data_path, "*.yaml"), []) :
yamldecode(file("${var.org_policies_data_path}/${f}"))
]...)
# simulate applying defaults to data coming from yaml files
_factory_data = {

View File

@ -38,8 +38,8 @@ def test_policy_implementation():
'+# tfdoc:file:description Folder-level organization policies.\n',
' \n',
' locals {\n',
' _factory_data_raw = (\n',
'@@ -69,8 +69,8 @@\n',
' _factory_data_raw = merge([\n',
'@@ -65,8 +65,8 @@\n',
' org_policies = {\n',
' for k, v in local._org_policies :\n',
' k => merge(v, {\n',
@ -64,8 +64,8 @@ def test_policy_implementation():
'+# tfdoc:file:description Organization-level organization policies.\n',
' \n',
' locals {\n',
' _factory_data_raw = (\n',
'@@ -69,8 +69,8 @@\n',
' _factory_data_raw = merge([\n',
'@@ -65,8 +65,8 @@\n',
' org_policies = {\n',
' for k, v in local._org_policies :\n',
' k => merge(v, {\n',
@ -76,7 +76,7 @@ def test_policy_implementation():
' \n',
' is_boolean_policy = v.allow == null && v.deny == null\n',
' has_values = (\n',
'@@ -143,4 +143,13 @@\n',
'@@ -139,4 +139,13 @@\n',
' }\n',
' }\n',
' }\n',