-
Hi, Given that stage 2 doesn't specifically create resources (e.g. cloud run) but projects and folders, it seems likely to apply the relaxed restriction on a project/folder level. Failing that, I guess we'd need IAM permissions in the (optional) automation project created in stage 2-PF to allow adding that tag. However, stage 2 doesn't know what IAM principals will exist in that project. I thought the "org_policy_tag_pf_scoped" constraint would handle this? I've also tried specifying it in tag_bindings up the stage hierarchy but it seems these are more for "context", "environment" and "custom tags". I can't seem to bind the org-policies/allowed-policy-member-domains-all ... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Sorry if this is a bit cryptic, will show some code tomorrow as soon as I have a few minutes, and we should document this, thanks for raising the topic. |
Beta Was this translation helpful? Give feedback.
-
Ach, so I forgot that org policy tags are in stage 0. In your stage 0 tfvars: org_policies_config = {
constraints = {
allowed_policy_member_domains = [
# ...any workspace customer IDs you need to add here
]
}
tag_values = {
allowed-policy-member-domains-all = {
iam = {
# replace prefix with your own prefix
"roles/resourcemanager.tagUser" = [
"serviceAccount:fast-05a-resman-pf-0@fast-05a-prod-iac-core-0.iam.gserviceaccount.com"
]
"roles/resourcemanager.tagViewer" = [
"serviceAccount:fast-05a-resman-pf-0r@fast-05a-prod-iac-core-0.iam.gserviceaccount.com"
]
}
}
}
} The tag value id you need in the binding is in the stage 0 JSON tfvars: "org_policy_tags": {
"key_id": "tagKeys/281483844453094",
"key_name": "org-policies",
"values": {
"allowed-policy-member-domains-all": "tagValues/281478523748783"
}
} This should be enough for the pf to then set tag bindings on folders or projects: tag_bindings:
org-policies-drs-allow-all: tagValues/281478523748783 module.projects.module.projects["prod-tb-0"].google_tags_tag_binding.binding["org-policies-drs-allow-all"]: Creation complete after 2s [id=tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F1044030836401/tagValues/281478523748783] |
Beta Was this translation helpful? Give feedback.
Ach, so I forgot that org policy tags are in stage 0.
In your stage 0 tfvars:
The tag value id you need …