Backend configuration changed error

Hi

If I init my cdktf, setup providers, codes and deploy it, destroy it as well, it’s fine and I didn’t configure backend at all. If I comeback after a couple of days, and run cdktf diff or deploy, it will get error on below,

$cdktf diff
test  Initializing the backend...

⠦  Processing
[2022-05-18T23:01:03.374] [ERROR] default - ╷
│ 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".
╵
test  ╷
      │ 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".
      ╵
      

⠦  Processing
External Error: Stack failed to plan: test. Please check the logs for more information.

What’s wrong?

Terraform=1.1.9
CDKTF=1.10
NPM=8.5.5
azurerm~>2.25
aws~>2.25

git azure=https://github.com/rv-terraform/cdktf-test.git(getting error on this)
git aws=https://github.com/rv-aws/aws1 (I’m not sure yet, I just test this one today)

Also, if I clone the repo to another folder, it will work. So this is annoying to work on existing folder.

Thanks.

@venerari are you still encountering this issue?

Some things to check if you are:

  • Are you running cdktf from the same directory?
  • What does cdktf.out/stacks/<stack>/cdktf.json show for the backend configuration?

Using the local (unconfigured) backend is generally not recommended since the state of your infrastructure is only stored locally on your computer. Take a look here for more information.