atlantis
atlantis copied to clipboard
workflows.default.plan.steps - run - printf output gets truncated at first whitespace
code sample has intentional yaml-invalid line-breaks for easier readability
workflows:
default:
plan:
steps:
- run: <arbitrary prior steps>
...
...
- run: echo data.aws_region.default.name | \
terraform${ATLANTIS_TERRAFORM_VERSION} console || \
printf 'your main.tf file does not provide default region.\ncheck \
https://github.com/company/project#maintf-examples on how to add \
expected "data" statement.\n\n'
- run: tflint --deep --aws-region=$(echo data.aws_region.default.name | \
terraform${ATLANTIS_TERRAFORM_VERSION} console)
...
...
I would like to provide some helper text for when certain steps fail. Instead of getting all the output, I'm only seeing the first word. then a carriage return and the output to next steps. I was expecting the first step to fail the plan.
Resource 'data.aws_region.default' not found for variable 'data.aws_region.default.name'
your ### <-- here's the fault. also expecting fail here but steps continue...
Resource 'data.aws_region.default' not found for variable 'data.aws_region.default.name'
What would the best step (unintentional pun) be here?
Would it be best to ... ?
- run script and return expected
exitcode instead of this bash one-liner - use
echostatement instead (assumingechoouts to different stream) - or peruse the code in this repo and see if there's anything obvious
This is due to the way we're parsing run steps. Add a \ to ' and a \ to your \n and it should work:
- run: mkdir a/b/c || printf \'your main.tf file does not provide default region.\\ncheck\'
Closing since I tested this and it works and I haven't heard back.
confirmed this works. thank you