cloudposse / cloudposse/atmos

Allow `terraform.generate` to be specifed globally

Open
#2,326 0 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

I would like to use the use the terraform generate functionality at a global level (so in a way that applies to all components).
Specifically I'm talking about this feature:
https://atmos.tools/cli/commands/terraform/generate/files

### Expected Behavior

I would expect that I can define file generation globally just like `terraform.backend` and `terraform.providers`. So:
```yaml
terraform:
generate:
locals.tf:
locals:
is_test: true
```
Would in fact generate a `locals.tf` in every component it it was included in a default at the top level of a stack.

### Use Case

I was thinking this might be a good way to handle `context.tf` files for us as we're likely writing all our components ourselves (or migrating in our current terraform root modules). So in this regard being able to configure atmos to generate the same `context.tf` for every component in one place would be very handy.

### Describe Ideal Solution

_No response_

### Alternatives Considered

I believe I could also probably use a common generic abstract component that all my catalog components inherit from to define `terraform.generate` in one place under the `components` key.
But I think that having it at a global level also compares nicely to other features like backend and providers.

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked terraform.generate documentation and trace how existing global terraform.backend and terraform.providers settings are handled. Determine where stack-level defaults are merged into component configuration, then verify that the example generate block produces locals.tf for every applicable component without overriding component-specific settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
terraform
Domain
infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.