Having some trouble with my workflow: ```config: ...
# atmos
j
Having some trouble with my workflow:
Copy code
config:
  plan: &plan
    - command: terraform generate planfile transit-gateway -f "{{ /atmos/tenable/{{ .vars.stage }}-transit-gateway.tfplan.json }}"
    - command: terraform generate planfile tgw-routing -f "{{ /atmos/tenable/{{ .vars.stage }}-tgw-routing.tfplan.json }}"
workflows:
  plan-ue1:
    description: |
      The steps in this workflow are run when a pull request is opened or updated.
      This workflow will plan the component with mock outputs for dependencies.
      It will not apply any changes.
    stack: cfsb-it-network-ue1
    steps: *plan
The goal is to leverage existing variables when noting the location of the planfile. Here is the error I am getting:
Copy code
The following command failed to execute:
 atmos terraform generate planfile transit-gateway -f "{{ /atmos/tenable/{{ .vars.stage }}-transit-gateway.tfplan.json }}" -s cfsb-it-network-ue1

To resume the workflow from this step, run:
 atmos workflow plan-ue1 -f run --from-step step1 -s cfsb-it-network-ue1
Not sure if it's a spacing, templating, or some other issue altogether.
g
@Andriy Knysh (Cloud Posse)
a
Atmos workflows currently don't support templating (stacks can be specified in any of these ways https://atmos.tools/core-concepts/workflows/#working-with-atmos-stacks-in-workflows)
supporting templates in workflows is a complex topic
e.g. to use templates, it will need context (defining all the template variables)
{{ .vars.stage }}
- the workflow will not have that var b/c it's related to some Atmos component in some stack, not to the workflow
to support templating in workflows, we'll need to decide how to provide the context - which will be some additional settings, and the context would be "hardcoded" - we don't know yet how to do it correctly
@Jonathan Rose
you can create workflows (or workflow steps) for each
stage
individually - not DRY, but will work
j
Got it - should I make a feature request?
Another idea would to be able to add
--dir
parameter to
atmos terraform generate planfile
so it places the resulting file in the desired directory and atmos controls what the name is
With the understanding you shouldn't use
--file
and
--dir
together and, in fact, raise an exception if you do
a
i think you are asking about
atmos terraform generate planfiles
command (to generate planfiles for all components in all stacks in one go)
Copy code
--file-template (required)
Varfile template (path, file name, and file extension). Supports absolute and relative paths. Supports context tokens: {namespace}, {tenant}, {environment}, {region}, {stage}, {base-component}, {component}, {component-path}. All subdirectories in the path will be created automatically.
https://atmos.tools/cli/commands/terraform/generate-planfile generates planfile for a specific component in a stack, but we can have
atmos terraform generate planfiles
as well
also as you mentioned, a
--dir
flag can be added to
atmos terraform generate planfile
j
I will make a feature request to add
--dir
to
atmos terraform generate planfile
to that each component's planfile is put into a desired directory.