blambda icon indicating copy to clipboard operation
blambda copied to clipboard

should clean delete terraform state?

Open VaclavSynacek opened this issue 11 months ago • 0 comments

What is the intended purpose of 'bb blambda clean'? How are you using it actually?

I realized (too late) that it also deletes the terraform state ( target/terraform.tfstate and target/terraform.tfstate.backup ), which makes it hard to do terraform destroy later or to deploy changes. So I had to manually delete the resources or manually import to blambda. Maybe others will get burnt by this too.

It seems to me that I am either missing how this is supposed to work or that this should be changed somehow. But there are several possible ways to change this so I would like to have your intent clear before attempting a pull request.

Ideas:

  • make clean not delete the state
    • move state out of target to some other directory
    • do not delete whole target, just the non-state part of it
  • check if state is empty and refuse to clean if it is not
  • make clean really clean everything - run terraform destroy first to clean the cloud first, then delete target when the state is empty

VaclavSynacek avatar Jan 17 '25 13:01 VaclavSynacek