Migrate from S3 to TFC ...AND... change workspace names

My project, whose state is currently in S3, contains 3 workspaces [default, ote, prod]. The default is clean.

I want to migrate [ote, prod] to TFC… BUT also change the workspace names [ote → proj1-ote, prod → proj1-prod]

Would you recommend:

(A) Perform the backend migration first, which would create an “ote” and “prod” workspace in TFC? Seems I can rename a workspace in TFC. Does this change get picked up locally on the next “init”?

(B) Pull the “ote” and “prod” state files down, while in their respective workspaces, create new workspaces, and push up the corresponding state files while in each new workspace?

My limited training with sunny-day scenarios has left me ill-prepared for this endeavor.

-swoop

Hi!

Using a cloud block in your configuration and running init will prompt an interactive migration process, and one of the possible actions to take is to rename your workspaces when moving to TFC according to any pattern you wish. In this case, you can enter the pattern proj1-* at that prompt.

More on this here: Initializing and Migrating to Terraform Cloud - Terraform CLI | Terraform by HashiCorp

1 Like