Hello guys, I think I’m a little confused about how to use modules, my idea is to create instances of new clients with the same root module and resource module as follows:
env
–prod
----main.tf
----modules.tf
modules
–module1
----instance.tf
----instance-variables.tf
----provider.tf
My problem is every time I deploy a new client it overwrites the older one, is there a way to achieve this to automate my deployment?
I think what you are looking for is to use a new workspace
for each instantiation.
When you try to plan/apply a new client as you say, it tries to overwrite the older one, because the two applications, although different instantiations of the same thing are put in the same state. You need to use separate states and one of the easiest ways to do this is by using a workspace.
If you haven’t already, be sure to read “When to use multiple workspaces”:
Then, instead of organising your environments by directory like you have now, you can organise them by workspace.