cloudposse / cloudposse/atmos

Extend `atmos terraform clean` to clean up custom paths

Open
#1,016 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.4k
Forks
175
Avg merge
2d 3h
Merged PRs (30d)
134

Description

### Describe the Feature

The `atmos terraform clean` command will clean up some well-known paths. However, running terraform commands and result in other temporary files getting created.

With this feature, atmos can clean up any files relative to the component's directory.

Path traversals (`../../../../etc/passwd`) are not allowed.

```yaml
# atmos.yaml
terraform:
clean:
paths:
- cache.txt
- **/*.zip
```

### Expected Behavior

Running `atmos terraform clean` will purge all well-known locations (like it does now), in addition to matching any of the `terraform.clean.paths` configured.

### Use Case

- Terraform component used to provision a lambda produces a `.zip` file that is orphaned
- Terraform component writes some temporary files that are not cleaned up

### Describe Ideal Solution

Modify the Atmos config to support the following:

```yaml
# atmos.yaml
terraform:
clean:
paths:
- cache.txt
- **/*.zip
```

### Alternatives Considered

We could create a "custom command" that also does this, but it's better that we have a core feature.

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.