Create GCP roles and GCP groups as list input variable to google_project_iam_member resource

-provider.google v3.26.0
-provider.google-beta v3.26.0

Is there a way where we can assign GCP roles to GCP groups with TF google_project_iam_member resource. Requirement is we want to define roles and groups as varibale as a list and then use iam member resource to assign all roles to each group defined in the variable list.

right now we use only one loop limiting to assign list of role to a single group.

locals {

roles = [
“roles/compute.viewer”,
“roles/compute.osLogin”,
“roles/iap.tunnelResourceAccessor”
]
}

resource “google_project_iam_member” “grp_permissions” {
provider = google-beta
project = var.project_name
for_each = { for x in local.roles : x => x }
role = each.key
member = join(":",[“group”, var.grp])
}

any suggestions??