abij / terraform-j2md

create readable terraform plan as markdown text from json plan output

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-j2md

Go goreleaser

Output human-readable markdown texts from Terraform plan JSON output.

Synopsis

Terraform can report plan to machine-readable JSON file. terraform-j2md is simple conversion tool, from Terraform JSON to Markdown texts.

Output texts may be useful as pull-request comments, and so on.

How to use

Installation

(TBD)

Usage

terraform-j2md reads only standard input, write only standard output.

terraform-j2md < [input file] > [output file]

Example

$ terraform init
$ terraform plan -out plan.tfplan

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # null_resource.foo will be created
  + resource "null_resource" "foo" {
      + id = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"

$ terraform show -json plan.tfplan | terraform-j2md
### 1 to add, 0 to change, 0 to destroy, 0 to replace.
- add
    - null_resource.foo
<details><summary>Change details</summary>

```diff
# null_resource.foo will be created
@@ -1 +1,3 @@
-null
+{
+  "triggers": null
+}
```

</details>

How to test/build

Test

go test ./...

Build

go build -o terraform-j2md cmd/terraform-j2md/main.go

About

create readable terraform plan as markdown text from json plan output


Languages

Language:Go 100.0%