Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update checklist parsing for top-level key #1997

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions fast/stages/0-bootstrap/checklist.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ locals {
)
# check that files are for the correct organization and ignore them if not
_cl_data = (
try(local._cl_data_raw.organization.id, null) != tostring(var.organization.id)
try(local._cl_data_raw.cloud_setup_config.organization.id, null) != tostring(var.organization.id)
? null
: local._cl_data_raw
: local._cl_data_raw.cloud_setup_config
)
_cl_org = (
try(local._cl_org_raw.organization.id, null) != tostring(var.organization.id)
try(local._cl_org_raw.cloud_setup_org_iam.organization.id, null) != tostring(var.organization.id)
? null
: local._cl_org_raw
: local._cl_org_raw.cloud_setup_org_iam
)
# do a first pass on IAM bindings to identify groups and normalize
_cl_org_iam_bindings = {
Expand Down Expand Up @@ -93,29 +93,29 @@ check "checklist" {
assert {
condition = (
var.factories_config.checklist_data == null ||
try(local._cl_data_raw.version, null) == "0.1.0"
try(local._cl_data_raw.cloud_setup_config.version, null) == "0.1.0"
)
error_message = "Checklist data version mismatch."
}
assert {
condition = (
var.factories_config.checklist_org_iam == null ||
try(local._cl_org_raw.version, null) == "0.1.0"
try(local._cl_org_raw.cloud_setup_org_iam.version, null) == "0.1.0"
)
error_message = "Checklist org IAM version mismatch."
}
# wrong org id forces us to ignore the files, but we also alert users
assert {
condition = (
var.factories_config.checklist_data == null ||
try(local._cl_data_raw.organization.id, null) == tostring(var.organization.id)
try(local._cl_data_raw.cloud_setup_config.organization.id, null) == tostring(var.organization.id)
)
error_message = "Checklist data organization id mismatch, file ignored."
}
assert {
condition = (
var.factories_config.checklist_org_iam == null ||
try(local._cl_org_raw.organization.id, null) == tostring(var.organization.id)
try(local._cl_org_raw.cloud_setup_org_iam.organization.id, null) == tostring(var.organization.id)
)
error_message = "Checklist org IAM organization id mismatch, file ignored."
}
Expand Down
8 changes: 4 additions & 4 deletions fast/stages/1-resman/checklist.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ locals {
)
# check that files are for the correct organization and ignore them if not
_cl_data = (
try(local._cl_data_raw.organization.id, null) != tostring(var.organization.id)
try(local._cl_data_raw.cloud_setup_config.organization.id, null) != tostring(var.organization.id)
? null
: local._cl_data_raw
: local._cl_data_raw.cloud_setup_config
)
# normalized IAM bindings one element per binding
_cl_iam = local._cl_data == null ? [] : flatten([
Expand Down Expand Up @@ -57,15 +57,15 @@ check "checklist" {
assert {
condition = (
var.factories_config.checklist_data == null ||
try(local._cl_data_raw.version, null) == "0.1.0"
try(local._cl_data_raw.cloud_setup_config.version, null) == "0.1.0"
)
error_message = "Checklist data version mismatch."
}
# wrong org id forces us to ignore the files, but we also alert users
assert {
condition = (
var.factories_config.checklist_data == null ||
try(local._cl_data_raw.organization.id, null) == tostring(var.organization.id)
try(local._cl_data_raw.cloud_setup_config.organization.id, null) == tostring(var.organization.id)
)
error_message = "Checklist data organization id mismatch, file ignored."
}
Expand Down