As i have created a terraform module called aws workspaces with directories by following the documentation. Here is the github public repo link
and when you will open this link you will see a section of important note and where i have mentioned the points of using this module. so as we use terraform to get rid of manual work but when directory gets created in aws then it doesnt create workspace and gives error that user doesnt exist so if we give Admin or Administrator then it gets created but if i have to give custom-user-name like mayank.sharma then for that i need to create user manually after directory gets created from terraform and then re-apply terraform apply to create workspace. so in my module i have specified that first you have to keep username empty so that no error will come and directory and other stuff will get created and then go to aws workspaces and create a user by choosing directory and then re run terraform apply to get workspace created.
So the only problem here is manual work of creating a user by going in workspace and by this we have to perform terraform apply two times which is not a good practice. so i really need a solution for this
For more information refer this and read out the points where i mentioned manual work