# Googleworkspace: specify multiple members dynamically from a variable

**URL:** <https://discuss.hashicorp.com/t/googleworkspace-specify-multiple-members-dynamically-from-a-variable/55158>\
**Category:** Terraform\
**Created:** [June 19, 2023, 9:55am UTC](https://discuss.hashicorp.com/t/googleworkspace-specify-multiple-members-dynamically-from-a-variable/55158 "2023-06-19T09:55:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alepuccetti](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/alepuccetti/32/7505_2.png) [@alepuccetti](https://discuss.hashicorp.com/u/alepuccetti)\
**Post date:** [June 19, 2023, 9:55am UTC](https://discuss.hashicorp.com/t/googleworkspace-specify-multiple-members-dynamically-from-a-variable/55158/1 "2023-06-19T09:55:42Z")

</div>

I know that using “googleworkspace\_group\_member” ( **singular** ). I can use “for\_each” and create dynamically multiple resources (one per account to grant the membership)

I would like to use “googleworkspace\_group\_members” ( **plural** ) because I can specify the membership in a single resource. I can do it fine if I write the “members” manually. However, I would like to generate them using a variable. Can I do that? How can I do it?

Thank you very much

[https://registry.terraform.io/providers/hashicorp/googleworkspace/latest/docs/resources/group\_members](https://registry.terraform.io/providers/hashicorp/googleworkspace/latest/docs/resources/group_members)

---

<div class="post-metadata">

**Author:** ![maxb](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/maxb/32/26655_2.png) [@maxb](https://discuss.hashicorp.com/u/maxb)\
**Post date:** [June 19, 2023, 9:58am UTC](https://discuss.hashicorp.com/t/googleworkspace-specify-multiple-members-dynamically-from-a-variable/55158/2 "2023-06-19T09:58:23Z")

</div>

Yes, but the syntax is a bit non-obvious.

You need to refer to [Dynamic Blocks - Configuration Language | Terraform | HashiCorp Developer](https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks)

---

<div class="post-metadata">

**Author:** ![alepuccetti](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/alepuccetti/32/7505_2.png) [@alepuccetti](https://discuss.hashicorp.com/u/alepuccetti)\
**Post date:** [June 19, 2023, 11:26am UTC](https://discuss.hashicorp.com/t/googleworkspace-specify-multiple-members-dynamically-from-a-variable/55158/3 "2023-06-19T11:26:07Z")

</div>

Great, thank you very much this worked.
