Skip to content

atmos terraform clean does not work properly #864

Closed

Description

@karaktaka

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

Activity

  1. added
    bug
    on Dec 17, 2024
  2. osterman commented on Dec 17, 2024

    @osterman
    Member

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

  3. karaktaka commented on Dec 17, 2024

    @karaktaka
    Author

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

  4. osterman commented on Dec 18, 2024

    @osterman
    Member

    I am able to reproduce this.

    atmos/examples/demo-localstack mergify*​ ≡
    ❯ atmos terraform clean --everything
    component '' is not enabled and skipped
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions