Aws workspaces (multi users)

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?

1 Like

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

1 Like

TFC mate thanks for quick reply

1 Like

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


You can programatically create workspaces with the API endpoint as well… 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.

1 Like

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
}

1 Like

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

Here’s a random example of for_each

1 Like

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?