atmos terraform clean
purpose
Use this command to delete the .terraform
folder, the folder that TF_DATA_DIR
ENV var points to, .terraform.lock.hcl
file, varfile
and planfile
for a
component in a stack.
Usage​
Execute the terraform clean
command like this:
atmos terraform clean <component> -s <stack> [--skip-lock-file] [--everything] [--force]
:::warning
The `--everything` flag will delete all Terraform-related files including state files. The `--force` flag will bypass confirmation prompts.
Use these flags with extreme caution as they can lead to irreversible data loss.
:::
tip
Run atmos terraform clean --help
to see all the available options
Examples​
# Delete all Terraform-related files for all components (with confirmation)
atmos terraform clean --everything
# Force delete all Terraform-related files for all components (no confirmation)
atmos terraform clean --everything --force
atmos terraform clean top-level-component1 -s tenant1-ue2-dev
atmos terraform clean infra/vpc -s tenant1-ue2-staging
atmos terraform clean infra/vpc -s tenant1-ue2-staging --skip-lock-file
atmos terraform clean test/test-component -s tenant1-ue2-dev
atmos terraform clean test/test-component-override-2 -s tenant2-ue2-prod
atmos terraform clean test/test-component-override-3 -s tenant1-ue2-dev
Arguments​
Argument | Description | Required |
---|---|---|
component | Atmos terraform component | yes |
Flags​
Flag | Description | Alias | Required |
---|---|---|---|
--stack | Atmos stack | -s | yes |
--dry-run | Dry run | no | |
--skip-lock-file | Skip deleting .terraform.lock.hcl | no |