Would there be interest in accepting a patch to au...
# atmos-dev
d
Would there be interest in accepting a patch to auto-clean generated files before/after any atmos command? We ran into an issue today where an engineer ran
atmos
, then selected
terraform plan
for a component/stack, and the plan was partially generated using an incorrect provider configuration.
Our setup is likely a little bespoke given the weirdness of this issue. We have a vendored component
vendor/cloud-sql-instance
, which is used as a root module in some stacks, but a child module in others. It seems that while the
atmos
cli is processing all stacks/components to show in the TUI, it needs to instantiate the backend for a
vendor/cloud-sql-instance
root module in order to fetch an output used in a separate component. For example:
Copy code
# stack-a.yaml
terraform:
  ...
  providers:
    google:
      project: production
components:
  terraform:
    vendor/cloud-sql-instance:
      ...
    apps/service:
      vars:
        cloudsql_instance: !terraform.output vendor/cloud-sql-instance {{ .stack }} connection_name

# stack-b.yaml
terraform:
  ...
  providers:
    google:
      project: staging

components:
  terraform:
    component-b:

# component-b.tf
module "database" {
  source = "../vendor/cloud-sql-instance"
  ...
}
It seems that since we call
!terraform.output vendor/cloud-sql-instance
, running
atmos
will generate
vendor/cloud-sql-instance/backend.tf.json
when it fetches the output. When using the component as a child module in
component-b.yaml
that backend override is added to our root module graph
a
the latest Atmos version (https://github.com/cloudposse/atmos/releases/tag/v1.170.0) does not process Go templates and YAML functions when generating the list of stacks and components for the TUI What version are you on?
(having said that, PRs and contributions are welcome, thank you)
e
Auto cleaning would need to be a configurable setting. For example with GitHub actions we generate files in one step and use them in the next
We do have atmos terraform clean, does that work for you?
We have recently introduced lifecycle hooks (currently only for store functionality). Maybe an
exec
lifecycle hook or a
clean
lifecycle hook would be one way to go about it.