title: Is it possible to link a terraform workspace to an AWS account
body: <p>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.</p>
  
  <p>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?</p>
  
  <p>One way I thought of, which is error prone, would be swap my <code>secret.auto.tfvars</code> 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. </p>
  
  <p>I'm looking for a way to almost link a workspace with an account id in AWS.</p>
  
  <p>I did find this <a href="https://github.com/hashicorp/terraform/issues/13700" rel="noreferrer">https://github.com/hashicorp/terraform/issues/13700</a> but it refers to the deprecated <code>env</code> command, <a href="https://github.com/hashicorp/terraform/issues/13700#issuecomment-299153589" rel="noreferrer">this comment</a> looked somewhat promising in particular </p>
  
  <h2>Update</h2>
  
  <p>I have found some information on GitHub where I left <a href="https://github.com/hashicorp/terraform/issues/13700#issuecomment-412940981" rel="noreferrer">this comment</a> 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.</p>