-
Notifications
You must be signed in to change notification settings - Fork 276
Solution for Terraform Output Command #80
Description
I'm trying to find some recommendations on how to most effectively leverage the use of terraform output in GitHub Actions.
Problem
Our Terraform workflow is pretty straight forward, init -> plan -> apply -> output. However, when trying to set an output in GitHub Actions, the wrapper's invocation is instead set as the output.
Example:
- name: Terraform Output
id: terraform-output
run: echo "::set-output name=ingress::$(terraform output ingress)"The value of ${{ steps.terraform-output.outputs.ingress }} ends up being "[command]/home/runner/work/_temp/297e1789-de2f-4ed5-ba5a-137f1a32e2ee/terraform-bin output ingress" which is incorrect.
Workaround
The solution I've seen is to add the terraform_wrapper: false option to the hashicorp/setup-terraform action. This does fix the issue, but now the step that comments on my PR no longer works because I can no longer access the stdout output since the wrapper is gone.
Problem with Workaround
I'd like to keep the functionality of being able to post a comment to my PR of the plan's results but also would like for terraform output to work. Is there an example or a recommendation on being able to accomplish both the PR comment and setting outputs with terraform output?