Repository navigation
Description
Have a question? Please checkout our Slack Community or visit our Slack Archive.
Describe the Feature
I cannot seem to get the atmos workspace name in the custom atmos commands
commands:
- name: tf
description: Execute terraform commands
commands:
- name: plan
arguments:
- name: component
description: Name of the component
flags:
- name: stack
shorthand: s
description: Name of the stack
required: true
env:
- key: ATMOS_COMPONENT
value: "{{ .Arguments.component }}"
- key: ATMOS_STACK
value: "{{ .Flags.stack }}"
steps:
- ATMOS_WORKSPACE=$(atmos describe component $ATMOS_COMPONENT --stack $ATMOS_STACK | yq .workspace)Error
⨠ atmos infracost plan eks/cluster-blue --stack plat-ue2-sandbox
Using ENV vars:
ATMOS_COMPONENT=eks/cluster-blue
ATMOS_STACK=plat-ue2-sandbox
Executing command:
ATMOS_WORKSPACE=$(atmos describe component eks/cluster-blue --stack plat-ue2-sandbox | yq .workspace)
exec: "ATMOS_WORKSPACE=$(atmos": executable file not found in $PATHI also tried quoting the entire step and it resulted in the same error.
I tried prefixing the string with export and it resulted in error.
exec: "export": executable file not found in $PATH
Expected Behavior
Run the command correctly or retrieve the atmos workspace
Use Case
I'd like to use the atmos workspace to access the planfile so I can create custom cli commands to run infracost or other tools on the plan file
Describe Ideal Solution
The ideal solution would be to use the choria-io library directly https://github.com/choria-io/appbuilder
so we can take advantage of the type: exec and script spec
flags:
- name: stack
description: Name of the stack
required: true
type: exec
script: |
set -x
ATMOS_WORKSPACE=$(atmos describe component $ATMOS_COMPONENT --stack $ATMOS_STACK | yq .workspace)Previous discussion: https://github.com/cloudposse/atmos/discussions/166
Alternatives Considered
Alternative 1
I considered concatenating the $ATMOS_STACK and $ATMOS_COMPONENT but this would not work because the file is
plat-ue2-sandbox-eks-cluster-blue.planfile
If I were to concatenate the stack and component, I would get this file name
plat-ue2-sandbox-eks-cluster/blue.planfile
And there is no way to do an in-line script (like in choria-io) where I can replace the / with a - to get the correct workspace / plan file name.
Alternative 2
- Write a shell script
- Save the shell script to a PATH directory so it's findable in any directory
- Run the shell script from the atmos custom cli steps
Additional Context
N/A
Activity
thejrose1984 commentedon May 31, 2026
This appears to be resolved on current
main✅I tried to reproduce this against
main(commit30238462, built locally) and the originally-reported error no longer occurs — custom-commandstepsare now run through a real shell interpreter, soVAR=$(...), pipes,export, and command substitution all work.Root cause (now fixed): steps are no longer word-split and
exec'd directly. The step type defaults toshelland runs viaExecuteShell→ShellRunner, which parses/interprets the command with the in-process shellmvdan.cc/sh/v3(pkg/utils/shell_utils.go). Steps also now accept an explicittype:field (shell/atmos/ extended types), which partially covers thetype: exec/scriptrequest from the issue.Reproduction — a custom command mirroring the report, including the
/→-workspace-name conversion from "Alternative 1":The exact constructs that previously failed (
ATMOS_WORKSPACE=$(atmos ...),export, pipes) now succeed, and the inline/→-conversion the reporter wanted works too.This looks like a good candidate to close as resolved. 🙏