Skip to content

add color to Terraform 12/13 plan output, also format it for markdown diff

License

Notifications You must be signed in to change notification settings

jeff-knurek/tfarbe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tfarbe

Add color to Terraform 12 plan output.

Inspired from: https://github.com/coinbase/terraform-landscape

NOTE: if you're using terraform v11, tfarbe will not help and you should use terraform-landscape.

Example of output

Improved Terraform plan output

Also formats the ouput for markdown diff.

For example, this:

  # module.apps.kubernetes_deployment.deployment is tainted, so must be replaced
-/+ resource "kubernetes_deployment" "deployment" {
      ~ id               = "some-app" -> (known after apply)
        wait_for_rollout = true

              ~ spec {
                  - active_deadline_seconds          = 0 -> null
                  - automount_service_account_token  = false -> null
                    dns_policy                       = "ClusterFirst"
                    host_ipc                         = false
                    host_network                     = false
                    host_pid                         = false
                  + hostname                         = (known after apply)
                  + node_name                        = (known after apply)
                    restart_policy                   = "Always"
                  + service_account_name             = (known after apply)

becomes:

# module.apps.kubernetes_deployment.deployment is tainted, so must be replaced
-/+ resource "kubernetes_deployment" "deployment" {
~       id               = "some-app" -> (known after apply)
        wait_for_rollout = true

~               spec {
-                   active_deadline_seconds          = 0 -> null
-                   automount_service_account_token  = false -> null
                    dns_policy                       = "ClusterFirst"
                    host_ipc                         = false
                    host_network                     = false
                    host_pid                         = false
+                   hostname                         = (known after apply)
+                   node_name                        = (known after apply)
                    restart_policy                   = "Always"
+                   service_account_name             = (known after apply)

Install

Binaries (should) be available on the Release page for both Linux and Mac. You can simple copy one of these binaries to your PATH.

Usage

terraform plan ... | tfarbe

with Docker

git clone https://github.com/jeff-knurek/tfarbe.git
cd tfarbe
docker build . -t tfarbe
....
terraform plan ... | docker run -i --rm tfarbe

Helpful bash addition

Add this to your .bash_profile/.bashrc/... accordingly

terraform() {
    if [[ $1 == "plan" ]]; then
        command terraform "$@" | docker run --rm -i tfarbe
    else
        command terraform "$@"
    fi
}

License

This project is released under the MIT license.

About

add color to Terraform 12/13 plan output, also format it for markdown diff

Topics

Resources

License

Stars

Watchers

Forks