Extend `atmos terraform clean` to clean up custom paths
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.
# 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
.zipfile 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:
# 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
@osterman
What if user want to clean specific files based on component or a combination of component and stack but never all.
I assume we should have an option for the above scenario.
Because currently we provide atmos terraform clean with stack and component filters.
Aha, such as in one component creates specific artifacts that should get cleaned up.
This would be in:
components:
terraform:
foobar:
settings:
terraform.clean.paths:
- foo.txt
vars:
...