Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atmos terraform clean does not work properly #864

Open
karaktaka opened this issue Dec 17, 2024 · 3 comments · May be fixed by #870
Open

atmos terraform clean does not work properly #864

karaktaka opened this issue Dec 17, 2024 · 3 comments · May be fixed by #870
Assignees
Labels
bug 🐛 An issue with the system Short List

Comments

@karaktaka
Copy link

karaktaka commented Dec 17, 2024

Describe the Bug

atmos terraform clean does not work. The cli help states, that without stack or component provided it will clean all components in all stacks, but running atmos terraform clean just returns the help and doesn't actually clean anything. Even running with --everything (which I actually do not want) just outputs component '' is not enabled and skipped.

It does work if run with a component and stack provided, but not in either other combination as stated in the help as well.

Expected Behavior

atmos should clean terraform files

Steps to Reproduce

Run atmos terraform clean. Just outputs the help.

atmos terraform clean --everything. Outputs: component '' is not enabled and skipped

atmos terraform clean -s <stack> also just outputs the help.

atmos terraform clean <component> reports that a stack is required

atmos terraform clean <component> -s <stack> does work

Screenshots

No response

Environment

  • OS: OSX
  • Version: 1.128.0
  • terraform version: 1.8.2

Additional Context

'atmos terraform clean' command deletes the following folders and files from the component's directory:

  • '.terraform' folder
  • folder that the 'TF_DATA_DIR' ENV var points to
  • '.terraform.lock.hcl' file
  • generated varfile for the component in the stack
  • generated planfile for the component in the stack
  • generated 'backend.tf.json' file
  • 'terraform.tfstate.d' folder (if '--everything' flag is used)

Usage: atmos terraform clean -s

Use '--everything' flag to also delete the Terraform state files and and directories with confirm message.

Use --force to forcefully delete Terraform state files and directories for the component.

  • If no component is specified, the command will apply to all components and stacks.
  • If no stack is specified, the command will apply to all stacks for the specified component.
    Use '--skip-lock-file' flag to skip deleting the '.terraform.lock.hcl' file.

If no component or stack is specified, the clean operation will apply globally to all components.

For more details refer to https://atmos.tools/cli/commands/terraform/clean

@karaktaka karaktaka added the bug 🐛 An issue with the system label Dec 17, 2024
@osterman
Copy link
Member

Out of curiosity, are you running this from the root of your project, or inside of a component folder?

@GabisCampana GabisCampana assigned osterman and unassigned haitham911 Dec 17, 2024
@karaktaka
Copy link
Author

I'm running this from the atmos root, which is also the repository root

@osterman
Copy link
Member

I am able to reproduce this.

atmos/examples/demo-localstack mergify*​ ≡
❯ atmos terraform clean --everything
component '' is not enabled and skipped

@osterman osterman added the Short List label Dec 18, 2024 — with Linear
@osterman osterman linked a pull request Dec 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system Short List
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants