项目作者: jeff-knurek

项目描述 :
add color to Terraform 12/13 plan output, also format it for markdown diff
高级语言: Go
项目地址: git://github.com/jeff-knurek/tfarbe.git
创建时间: 2020-09-21T09:10:51Z
项目社区:https://github.com/jeff-knurek/tfarbe

开源协议:MIT License

下载


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:

  1. # module.apps.kubernetes_deployment.deployment is tainted, so must be replaced
  2. -/+ resource "kubernetes_deployment" "deployment" {
  3. ~ id = "some-app" -> (known after apply)
  4. wait_for_rollout = true
  5. ~ spec {
  6. - active_deadline_seconds = 0 -> null
  7. - automount_service_account_token = false -> null
  8. dns_policy = "ClusterFirst"
  9. host_ipc = false
  10. host_network = false
  11. host_pid = false
  12. + hostname = (known after apply)
  13. + node_name = (known after apply)
  14. restart_policy = "Always"
  15. + service_account_name = (known after apply)

becomes:

  1. # module.apps.kubernetes_deployment.deployment is tainted, so must be replaced
  2. -/+ resource "kubernetes_deployment" "deployment" {
  3. ~ id = "some-app" -> (known after apply)
  4. wait_for_rollout = true
  5. ~ spec {
  6. - active_deadline_seconds = 0 -> null
  7. - automount_service_account_token = false -> null
  8. dns_policy = "ClusterFirst"
  9. host_ipc = false
  10. host_network = false
  11. host_pid = false
  12. + hostname = (known after apply)
  13. + node_name = (known after apply)
  14. restart_policy = "Always"
  15. + 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

  1. terraform plan ... | tfarbe

with Docker

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

Helpful bash addition

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

  1. terraform() {
  2. if [[ $1 == "plan" ]]; then
  3. command terraform "$@" | docker run --rm -i tfarbe
  4. else
  5. command terraform "$@"
  6. fi
  7. }

License

This project is released under the MIT license.