hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.79k stars 443 forks source link

COMPONENT: Running terraform --reconfigure --upgrade through cdktf #3615

Open mimozell opened 2 months ago

mimozell commented 2 months ago

Description

Trying to understand how to work with cdktf when using a newer version of terraform. My current experience is that when doing the TF upgrade and running a cdktf deploy, I get this error:

          │ 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".

Is there some way to handle this without going to each cdktf.out folder and running terraform? That is very cumbersome to do and should be handled at the cdktf stack level. In the documentation I don't see any information related to this.

Links

Docs don't exist

Help Wanted

Community Note

starbuggx commented 2 weeks ago

I ran this command, and the migration didn't work, instead, so many resources were created. cdktf deploy --migrate-state