-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
terraform-compliance prints one extra line of command which makes json invalid in githib actions. How to turn this command off? #366
Comments
Well, this is interesting. Let me try to reproduce this problem |
What is |
@eerkunt @tr00p86 it works for me with the following command. /home/ec2-user/actions-runner/_work/_temp/terraform-bin is the github actions wrapper that comes automatically while using terraform libraries. Issue seems like from Github Actions it executes one extra line of [command] which redirects it out to a plan.out.json file and makes it an invalid json. if I try from cli, it doesn't generate that extra line. terraform plan -out=plan.out |
Hello @rupeshphuyal, Thanks for trying this out, it looks like Github Action's terraform wrapper is dumping that out to STDOUT, it wouldn't be a problem it was redirected to STDERR, instead of STDOUT. 🤷♂️ I will have a look at this one, assuming |
Hi @rupeshphuyal, Please use https://github.com/marketplace/actions/terraform-compliance for github actions :) Let me know if you have any problems. |
thank you @eerkunt. There is one problem I see PARAMETERS="/home/runner/.local/bin/terraform-compliance" I am using a selfhosted runner and my path is /home/ubuntu/../../terraform-compliance user and I got the following error:
|
Thanks @rupeshphuyal. Let me also add Will update here soon. |
@rupeshphuyal, can you have a try with e.g. an example step definition ; steps:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
- uses: terraform-compliance/github_action@standalone-run
with:
installed_path: /home/ubuntu/../../terraform-compliance # or wherever it is installed will merge to Thanks a lot 🎉 |
@eerkunt its failing while linking if the file already exists, Could you add a line to check if the file already exists then skip creating link again?
or just change the following no need of the link. PARAMETERS="/home/`id -u -n`/.local/bin/terraform-compliance" |
That is a bit weird, since we are already checking if the file exists with ; if [ ! -f /usr/local/bin/terraform-compliance ] there. It looks like a racing condition. I will add |
Sorry, looks like I misunderstood :) You were suggesting that to be added. Would be nice it that was a PR :D Releasing a new version of github action |
Released https://github.com/terraform-compliance/github_action/releases/tag/0.3.0 You can also use |
Closing this issue since it has been waiting for a while. Please do not hesitate to create a new issue if the problem still persists. 🎉 |
error:
`terraform-compliance -p plan.out.json -f .
terraform-compliance v1.3.3 initiated
ERROR: plan.out.json is not a valid JSON file
##[error]Process completed with exit code 1.`
`cat plan.out.json |head -1
[command]/home/ec2-user/actions-runner/_work/_temp/terraform-bin show -json plan.out`
The text was updated successfully, but these errors were encountered: