Clone existing workspace on app.terraform.io

Hello,

I have an existing workspace setup on app.terraform.io with VCS integration (GitLab) and some terraform variables. I want to create a new workspace out of it but this new workspace runs from a different branch. Can we clone existing workspace to avoid copying all the variables and other settings again to save time.

1 Like

Let me get this straight:

You have an existing workspace with state, VCS settings (branch and folder), and Variables, right?

Do you want to clone the exact state, or just the Terraform Variables and VCS settings?

Could you explain in more detail?

Hello @v61,

I don’t want to copy state but only VCS settings and Terraform variables. After cloning the workspace, I will only change the branch to run terraform against. For now, my Terraform variables may remain same but are guaranteed to change.

If you want to copy over Terraform Variables, I know of a tool for this.

It’s probably not relevant to your case, but I have used and recommended tfh to clients, in the past, for copying over Variables and Values from one Terraform Enterprise workspace to another:

However, it does not copy the values for Sensitive Variables, because these are stored in Vault with a write-only policy.

I guess you could even write your own scripts for this, because tfh pretty much just wraps the Terraform Enterprise API.

You can’t copy or clone workspaces. The tf-helper tool is nice and you can also use the TFE provider to help manage multiple workspaces. https://www.terraform.io/docs/providers/tfe/index.html