Skip to content

atmos terraform clean does not work properly #864

@karaktaka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions