# Aws workspaces (multi users)

**URL:** <https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090>\
**Category:** Terraform\
**Created:** [July 7, 2020, 12:51am UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090 "2020-07-07T00:51:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![urfanazad](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/urfanazad/32/9067_2.png) [@urfanazad](https://discuss.hashicorp.com/u/urfanazad)\
**Post date:** [July 7, 2020, 12:51am UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090/1 "2020-07-07T00:51:39Z")

</div>

hi guys, needs to help currently I have created workspaces for 1 user and I want to know what would be the code for creating the workspace and having multiple users do I use a parameter in ssm and use that as a datasource with split? or is there another way, because I am losing alot of sleep currently and help?

---

<div class="post-metadata">

**Author:** ![mikegreen](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mikegreen/32/3160_2.png) [@mikegreen](https://discuss.hashicorp.com/u/mikegreen)\
**Post date:** [July 7, 2020, 2:07pm UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090/2 "2020-07-07T14:07:42Z")

</div>

Are you talking of a Terraform CLI workspace? Or is this TFE/TFC?

---

<div class="post-metadata">

**Author:** ![urfanazad](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/urfanazad/32/9067_2.png) [@urfanazad](https://discuss.hashicorp.com/u/urfanazad)\
**Post date:** [July 7, 2020, 2:42pm UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090/3 "2020-07-07T14:42:08Z")

</div>

TFC mate thanks for quick reply

---

<div class="post-metadata">

**Author:** ![mikegreen](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mikegreen/32/3160_2.png) [@mikegreen](https://discuss.hashicorp.com/u/mikegreen)\
**Post date:** [July 8, 2020, 2:29pm UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090/4 "2020-07-08T14:29:42Z")

</div>

If you’ve created one workspace in TFC, you do the same to create more.

> **[Creating Workspaces - Workspaces - Terraform Cloud and Terraform Enterprise -...](https://www.terraform.io/docs/cloud/workspaces/creating.html)**
>
> Terraform by HashiCorp

  
You can programatically create workspaces with the API endpoint as well… [https://www.terraform.io/docs/cloud/api/workspaces.html#create-a-workspace](https://www.terraform.io/docs/cloud/api/workspaces.html#create-a-workspace)

Your question is pretty vague - if you can expand on exactly what you’re trying to do, might be able to help.

---

<div class="post-metadata">

**Author:** ![urfanazad](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/urfanazad/32/9067_2.png) [@urfanazad](https://discuss.hashicorp.com/u/urfanazad)\
**Post date:** [July 10, 2020, 9:04pm UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090/5 "2020-07-10T21:04:25Z")

</div>

ok so this is my workspace.tf I have one name hardcoded which pre exists in the AD, i have added more names in the AD but I dont want to create another workspace.tf, how can I add multiple users?

resource “aws\_workspaces\_workspace” “uazad” {  
directory\_id = “{aws\_directory\_service\_directory.tap-adconnector.id}" bundle\_id = "{data.aws\_workspaces\_bundle.value\_windows\_10.id}”  
user\_name = “urfanazad”

root\_volume\_encryption\_enabled = true  
user\_volume\_encryption\_enabled = true  
volume\_encryption\_key = “alias/aws/workspaces”

workspace\_properties {  
compute\_type\_name = “VALUE”  
user\_volume\_size\_gib = 10  
root\_volume\_size\_gib = 80  
running\_mode = “AUTO\_STOP”  
running\_mode\_auto\_stop\_timeout\_in\_minutes = 60  
}

---

<div class="post-metadata">

**Author:** ![mikegreen](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mikegreen/32/3160_2.png) [@mikegreen](https://discuss.hashicorp.com/u/mikegreen)\
**Post date:** [July 10, 2020, 11:29pm UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090/6 "2020-07-10T23:29:16Z")

</div>

You’ll want to populate a list and then have TF iterate thru it with `for_each`

> **[Resources - Configuration Language - Terraform by HashiCorp](https://www.terraform.io/docs/configuration/resources.html#for_each-multiple-resource-instances-defined-by-a-map-or-set-of-strings)**
>
> Resources are the most important element in a Terraform configuration. Each resource corresponds to an infrastructure object, such as a virtual network or compute instance.

Here’s a random example of for\_each

> <https://github.com/hixichen/terraform-perf-test/blob/master/modules/dev/auth-personnel.tf>

---

<div class="post-metadata">

**Author:** ![rmgval](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/rmgval/32/15393_2.png) [@rmgval](https://discuss.hashicorp.com/u/rmgval)\
**Post date:** [December 8, 2020, 6:11pm UTC](https://discuss.hashicorp.com/t/aws-workspaces-multi-users/11090/7 "2020-12-08T18:11:49Z")

</div>

I have a similar question. I have my code tuned up to create a workspace. But I have to create at least 16 for 16 different users. Can anyone help me accomplish this?
