Output human-readable markdown texts from Terraform plan JSON output.
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.
% go install github.com/reproio/terraform-j2md/cmd/terraform-j2md@latest
- uses: reproio/terraform-j2md@main
with:
version: v0.0.7 # or latest
terraform-j2md reads only standard input, write only standard output.
terraform-j2md < [input file] > [output file]
$ 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>
make test
make build