If one has two AWS accounts, one for development and one for live (for example) I am aware that one can use terraform workspaces to manage the state of each environment.

However, if i switch workspace from "dev" to "live" is there a way to tell terraform it should now be applying the state to the live account rather than the test one?

One way I thought of, which is error prone, would be swap my `secret.auto.tfvars` file each time i switch workspace since I presume when running with a different access key (the one belonging to the "live" account) the AWS provider will then be applying to that account. However, it'd be very easy to swap workspace and have the wrong credentials present which would run the changes against the wrong environment. 

I'm looking for a way to almost link a workspace with an account id in AWS.

I did find this <https://github.com/hashicorp/terraform/issues/13700> but it refers to the deprecated `env` command, [this comment](https://github.com/hashicorp/terraform/issues/13700#issuecomment-299153589) looked somewhat promising in particular 

Update
------

I have found some information on GitHub where I left [this comment](https://github.com/hashicorp/terraform/issues/13700#issuecomment-412940981) as a reply to an earlier comment which recommended considering modules instead of workspaces and actually indicates that workspaces aren't well suited to this task. If anyone can provide information on how modules could be used to solve this issue of maintaining multiple versions of the "same" infrastructure concurrently I'd be keen to see how this improves upon the workspace concept.