Skip to content

Commit

Permalink
Remove explicit dependency on the custom roles
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktorn committed Nov 14, 2023
1 parent 1e6a680 commit c833637
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/organization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ module "org" {

## Custom Roles

Custom roles can be defined via the `custom_roles` variable, and referenced via the `custom_role_id` output:
Custom roles can be defined via the `custom_roles` variable, and referenced via the `custom_role_id` output (this also provides explicit dependency on the custom role):

```hcl
module "org" {
Expand Down
14 changes: 7 additions & 7 deletions modules/organization/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ resource "google_organization_iam_custom_role" "roles" {
}

resource "google_organization_iam_binding" "authoritative" {
for_each = local.iam
org_id = local.organization_id_numeric
role = each.key
members = each.value
depends_on = [google_organization_iam_custom_role.roles]
for_each = local.iam
org_id = local.organization_id_numeric
role = each.key
members = each.value
# ensuring that custom role exists is left to the caller, by leveraging custom_role_id output
}

resource "google_organization_iam_binding" "bindings" {
Expand All @@ -62,7 +62,7 @@ resource "google_organization_iam_binding" "bindings" {
description = each.value.condition.description
}
}
depends_on = [google_organization_iam_custom_role.roles]
# ensuring that custom role exists is left to the caller, by leveraging custom_role_id output
}

resource "google_organization_iam_member" "bindings" {
Expand All @@ -78,5 +78,5 @@ resource "google_organization_iam_member" "bindings" {
description = each.value.condition.description
}
}
depends_on = [google_organization_iam_custom_role.roles]
# ensuring that custom role exists is left to the caller, by leveraging custom_role_id output
}

0 comments on commit c833637

Please sign in to comment.