Fix AW Folder reference when creating common services folder - #169
Conversation
Calvin-Cheng1
left a comment
There was a problem hiding this comment.
Only concern I have with this approach is the assured_workloads_folder can potentially = a no compliance folder if no regime is selected which probably doesn't happen often but would be a incorrect statement.
Thoughts on this using a local in organization.tf as:
consumer_folder_id = try(one([
for r in google_assured_workloads_workload.primary[0].resources : r.resource_id if r.resource_type == "CONSUMER_FOLDER"
]), null)
This should evaluate to the AW folder in IL5 and always result in 1 and not the CMEK project.
Then we can keep the same logic as before and change:
var.assured_workloads.regime != "COMPLIANCE_REGIME_UNSPECIFIED" ? "folders/${google_assured_workloads_workload.primary[0].resources[0].resource_id}" : "folders/${module.no-compliance-folder[0].folder.id}"
to:
var.assured_workloads.regime != "COMPLIANCE_REGIME_UNSPECIFIED" ? "folders/${local.consumer_folder_id}" : "folders/${module.no-compliance-folder[0].folder.id}"
Description
Explicitly look for the
CONSUMER_FOLDERcreated by thegoogle_assured_workloads_workloadterraform resource to use as the parent for the Common Services child folder.Fixes #168
Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/can be leveraged for this change.documentation/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Testing Performed
Tested via an IL5 deployment.