Add `--everything` and `--force` flags to the `atmos terraform clean` command @haitham911 (#727)
What
- Add
--everything
and--force
flags to theatmos terraform clean
command to delete the Terraform-related folders and files, including:backend.tf.json
.terraform
terraform.tfstate.d
.terraform.lock.hcl
The following scenarios are covered:
-
If no component is specified:
atmos terraform clean --everything
deletes all state files for all Terraform components and requires a confirmation from the user
atmos terraform clean --everything --force
deletes all state files for all Terraform components without a confirmation from the user -
If a specific component is specified:
atmos terraform clean <component> --everything
- deletes the state files for the specified component -
If both a component and a stack are specified:
atmos terraform clean <component> --stack<stack> --everything
- deletes the state files for the specified component and stack
Why
- Cleaning state files is useful when running tests (it should not be the default behavior to avoid unintended data loss)
Usage
atmos terraform clean <component> -s <stack> [--skip-lock-file] [--everything] [--force]