Migrate existing resources into Terraspace stack

I am attempting to migrate a Terraform project to use Terraspace to take advantage of the additional features.

Screen Shot 2022-06-10 at 10.39.53

I’ve copied my VPC resource into a folder within my stack directory. I copied in the .terraform & terraform.tfstate file.

I’d like to run the below and get it pick up my current remote state

AWS_REGION=eu-west-1 TS_ENV=new-schema terraspace plan vpc

However, I get the following error:

Building .terraspace-cache/eu-west-1/new-schema/stacks/vpc
Built in .terraspace-cache/eu-west-1/new-schema/stacks/vpc
Current directory: .terraspace-cache/eu-west-1/new-schema/stacks/vpc
=> terraform plan -input=false
╷
Terraform reinitialization required detected. Will run `terraform init` and try again.
=> terraform init -get -input=false >> /tmp/terraspace/log/init/vpc.log
╷
│ **Error:** **Backend configuration changed**
│
│ A change in the backend configuration has been detected, which may require
│ migrating existing state.
│
│ If you wish to attempt automatic migration of the state, use "terraform
│ init -migrate-state".
│ If you wish to store the current configuration with no changes to the
Terraform reinitialization required detected. Will run `terraform init` and try again.
=> terraform init -get -input=false >> /tmp/terraspace/log/init/vpc.log

attempt to run

AWS_REGION=eu-west-1 TS_ENV=new-schema terraspace init vpc

d get the exact same error as above:
Terraform reinitialization required detected. Will run `terraform init` and try again.
=> terraform init -get -input=false
**Initializing modules...**
**Initializing the backend...**
╷
│ **Error:** **Backend configuration changed**
│
│ A change in the backend configuration has been detected, which may require
│ migrating existing state.
│
│ If you wish to attempt automatic migration of the state, use "terraform
│ init -migrate-state".
│ If you wish to store the current configuration with no changes to the
ERROR after max retries 1: ╷
│ **Error:** **Backend configuration changed**
│
│ A change in the backend configuration has been detected, which may require
│ migrating existing state.
│
│ If you wish to attempt automatic migration of the state, use "terraform
│ init -migrate-state".
│ If you wish to store the current configuration with no changes to the
│ state, use "terraform init -reconfigure"

I successfully did this with an ECS stack that isn’t using a module so unsure if this is what is causing the issue. I also tried to cd into the stack and run terraform init but no luck

Unsure. May need more debugging info. Wondering what the generated backend.tf looks like. The message **Error:** **Backend configuration changed** seems to indicate that it changed. Unsure why though.

Also, maybe there’s something funny with the cache. This clears it:

terraspace clean all 

Though, it may remove the reproduction of the issue. :thinking:

Note: Also, looks like image uploads aren’t properly working. Bummer. Hope to dig into that and getting that fixed.

Running terraspace clean all and then running the terraspace plan command worked!

Thank you :pray: