forked from GoogleCloudPlatform/cloud-foundation-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factories refactor (GoogleCloudPlatform#1843)
* factories refactor doc * Adds file schema and filesystem organization * Update 20231106-factories.md * move factories out of blueprints and create new factories README * align factory in billing-account module * align factory in dataplex-datascan module * align factory in billing-account module * align factory in net-firewall-policy module * align factory in dns-response-policy module * align factory in net-vpc-firewall module * align factory in net-vpc module * align factory variable names in FAST * remove decentralized firewall blueprint * bump terraform version * bump module versions * update top-level READMEs * move project factory to modules * fix variable names and tests * tfdoc * remove changelog link * add project factory to top-level README * fix cludrun eventarc diff * fix README * fix cludrun eventarc diff --------- Co-authored-by: Simone Ruffilli <[email protected]>
- Loading branch information
Showing
6 changed files
with
265 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
locals { | ||
_factory_data = ( | ||
var.factories_config.data_quality_spec == null | ||
? null | ||
: yamldecode(file(pathexpand(var.factories_config.data_quality_spec))) | ||
) | ||
factory_data = { | ||
post_scan_actions = try( | ||
local._factory_data.postScanActions, | ||
local._factory_data.post_scan_actions, | ||
null | ||
) | ||
row_filter = try( | ||
local._factory_data.rowFilter, | ||
local._factory_data.row_filter, | ||
null | ||
) | ||
rules = [ | ||
for rule in try(local._factory_data.rules, []) : { | ||
column = try(rule.column, null) | ||
ignore_null = try(rule.ignoreNull, rule.ignore_null, null) | ||
dimension = rule.dimension | ||
threshold = try(rule.threshold, null) | ||
non_null_expectation = try( | ||
rule.nonNullExpectation, rule.non_null_expectation, null | ||
) | ||
range_expectation = ( | ||
can(rule.rangeExpectation) || can(rule.range_expectation) | ||
? { | ||
min_value = try( | ||
rule.rangeExpectation.minValue, | ||
rule.range_expectation.min_value, | ||
null | ||
) | ||
max_value = try( | ||
rule.rangeExpectation.maxValue, | ||
rule.range_expectation.max_value, | ||
null | ||
) | ||
strict_min_enabled = try( | ||
rule.rangeExpectation.strictMinEnabled, | ||
rule.range_expectation.strict_min_enabled, | ||
null | ||
) | ||
strict_max_enabled = try( | ||
rule.rangeExpectation.strictMaxEnabled, | ||
rule.range_expectation.strict_max_enabled, | ||
null | ||
) | ||
} | ||
: null | ||
) | ||
regex_expectation = ( | ||
can(rule.regexExpectation) || can(rule.regex_expectation) | ||
? { | ||
regex = try( | ||
rule.regexExpectation.regex, rule.regex_expectation.regex, null | ||
) | ||
} | ||
: null | ||
) | ||
set_expectation = ( | ||
can(rule.setExpectation) || can(rule.set_expectation) | ||
? { | ||
values = try( | ||
rule.setExpectation.values, rule.set_expectation.values, null | ||
) | ||
} | ||
: null | ||
) | ||
uniqueness_expectation = try( | ||
rule.uniquenessExpectation, rule.uniqueness_expectation, null | ||
) | ||
statistic_range_expectation = ( | ||
can(rule.statisticRangeExpectation) || can(rule.statistic_range_expectation) | ||
? { | ||
statistic = try( | ||
rule.statisticRangeExpectation.statistic, | ||
rule.statistic_range_expectation.statistic | ||
) | ||
min_value = try( | ||
rule.statisticRangeExpectation.minValue, | ||
rule.statistic_range_expectation.min_value, | ||
null | ||
) | ||
max_value = try( | ||
rule.statisticRangeExpectation.maxValue, | ||
rule.statistic_range_expectation.max_value, | ||
null | ||
) | ||
strict_min_enabled = try( | ||
rule.statisticRangeExpectation.strictMinEnabled, | ||
rule.statistic_range_expectation.strict_min_enabled, | ||
null | ||
) | ||
strict_max_enabled = try( | ||
rule.statisticRangeExpectation.strictMaxEnabled, | ||
rule.statistic_range_expectation.strict_max_enabled, | ||
null | ||
) | ||
} | ||
: null | ||
) | ||
row_condition_expectation = ( | ||
can(rule.rowConditionExpectation) || can(rule.row_condition_expectation) | ||
? { | ||
sql_expression = try( | ||
rule.rowConditionExpectation.sqlExpression, | ||
rule.row_condition_expectation.sql_expression, | ||
null | ||
) | ||
} | ||
: null | ||
) | ||
table_condition_expectation = ( | ||
can(rule.tableConditionExpectation) || can(rule.table_condition_expectation) | ||
? { | ||
sql_expression = try( | ||
rule.tableConditionExpectation.sqlExpression, | ||
rule.table_condition_expectation.sql_expression, | ||
null | ||
) | ||
} | ||
: null | ||
) | ||
} | ||
] | ||
sampling_percent = try( | ||
local._factory_data.samplingPercent, | ||
local._factory_data.sampling_percent, | ||
null | ||
) | ||
} | ||
} |
Oops, something went wrong.