terraform-plan-parser | Command line utility and JavaScript API | Infrastructure Automation library
kandi X-RAY | terraform-plan-parser Summary
kandi X-RAY | terraform-plan-parser Summary
This project provides a CLI and JavaScript API for parsing terraform plan output. IMPORTANT: This tool does not parse the file produced by the -out=path argument to terraform plan which is a binary file. There is not a stable specification for this binary file format so, at this time, it is safer to parse the somewhat structured textual output that gets written to stdout.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of terraform-plan-parser
terraform-plan-parser Key Features
terraform-plan-parser Examples and Code Snippets
Community Discussions
Trending Discussions on terraform-plan-parser
QUESTION
I have set up an automation through github/jenkins to post the output of terraform plan for the repo through jenkins as a comment to the pull request in github. The entire orchestration works great except for the fact that the output of terraform plan is not that human readable and doesn't provide you in this kind of automation a way as it looks when you run it in a terminal. I used several ways like using terraform show for the plan file, then grabbing that to a custom file and posting that as a comment in GitHub PR. In every case the output contains some binary characters.
i even used the terraform-plan-parser https://github.com/lifeomic/terraform-plan-parser but that doesn't work for terraform 0.12 and relates to the below issue :- https://github.com/lifeomic/terraform-plan-parser/issues/31
What's the best way to retrieve the output of any terraform plan in automation so that it can be referenced however that needs to be to inspect before the apply is done. Looks to me it only works great in a terminal.
Any help or suggestions here will be greatly appreciated as always.
...ANSWER
Answered 2019-Nov-07 at 23:55By default Terraform uses terminal escape sequences to highlight parts of the output with simple formatting such as colors or a bold typeface.
In order to reproduce that result exactly in the context of GitHub would require translating the terminal escape sequences into a form that GitHub is able to render.
Unfortunately GitHub comments are written in GitHub-flavored Markdown, which doesn't support any direct way to create colored text similar to Terraform's plan output at the time when I'm write this. Therefore I know of no easy way to reproduce the text formatting from the Terraform plan output in a GitHub comment.
If you run terraform plan
with the -no-color
option then it will skip the terminal escape sequences and produce plain-text output that you could include in a preformatted text block in your Markdown comment. However, that output will therefore not include the text formatting you normally see in your terminal.
If you are willing to write some custom formatting code to present the Terraform plan in a different format for your GitHub comments, you can obtain a JSON representation of the plan by saving the plan to disk and then reading it with terraform show
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install terraform-plan-parser
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page