Love Eklund
10/03/2025, 3:10 PMcomponents:
terraform:
container_job/defaults:
metadata:
type: abstract
vars:
env:
- name: foo
value: bar
...
...
..,
- name: foo100
value: bar100
command: ["echo","baz"]
Now if if I want to reuse this component and add some extra env variables in one verions of the job that works fine if I have the list_merge_strategy = append . However, if I also want to override the command to instead be ["echo", "foo"] it becomes ["echo", "baz", "echo", "foo" ] ( due to the append)
is there a way around this or a better way to handle it?Andriy Knysh (Cloud Posse)
10/03/2025, 3:37 PMenv section is a map, not a list (similar to the vars section)
env:
foo: barAndriy Knysh (Cloud Posse)
10/03/2025, 3:37 PMAndriy Knysh (Cloud Posse)
10/03/2025, 3:38 PMAndriy Knysh (Cloud Posse)
10/03/2025, 3:41 PMenv var, not the env sectionAndriy Knysh (Cloud Posse)
10/03/2025, 3:41 PMAndriy Knysh (Cloud Posse)
10/03/2025, 3:42 PMatmos.yaml (note this is a global setting, it will affect all lists in the stacks, we don't have the ability to change an individaul list yet, but we'll imprlrmrnt it)
settings:
# `list_merge_strategy` specifies how lists are merged in Atmos stack manifests.
# Can also be set using 'ATMOS_SETTINGS_LIST_MERGE_STRATEGY' environment variable, or '--settings-list-merge-strategy' command-line argument
# The following strategies are supported:
# `replace`: Most recent list imported wins (the default behavior).
# `append`: The sequence of lists is appended in the same order as imports.
# `merge`: The items in the destination list are deep-merged with the items in the source list.
# The items in the source list take precedence.
# The items are processed starting from the first up to the length of the source list (the remaining items are not processed).
# If the source and destination lists have the same length, all items in the destination lists are
# deep-merged with all items in the source list.
list_merge_strategy: replaceAndriy Knysh (Cloud Posse)
10/03/2025, 3:46 PMvars.env, then import them into the stack(s) and inherit from them. Different real components can inherit an abstract component with the required vars.env. See https://atmos.tools/design-patterns/abstract-component
(this is similar to base abstract class in OOP)Andriy Knysh (Cloud Posse)
10/03/2025, 3:50 PMAbstract Component Atmos Design Pattern , you can also use the Partial Component Configuration pattern https://atmos.tools/design-patterns/partial-component-configuration. The difference is that in this case, you import different 'parts' of the same component (not anstract base) into the stacks, and you can have those parts defined with different vars.env configuration, and import one of those into the stack to add that 'part' to your component
(this is similar to partial classes in OOP, e.g. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/partial-classes-and-methods)Andriy Knysh (Cloud Posse)
10/03/2025, 3:52 PMLove Eklund
10/03/2025, 4:10 PMErik Osterman (Cloud Posse)
10/03/2025, 5:38 PMLove Eklund
10/05/2025, 11:52 AMcomponents:
terraform:
container_job/defaults:
overrides:
vars:
command:["echo","baz"]
metadata:
component: container_job
inherit: container_job/defaults
and get what I wantErik Osterman (Cloud Posse)
10/05/2025, 1:09 PMErik Osterman (Cloud Posse)
10/05/2025, 1:12 PMErik Osterman (Cloud Posse)
10/05/2025, 1:13 PMtags_as_list_of_mapsErik Osterman (Cloud Posse)
10/05/2025, 1:13 PM