terramaid

command module
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

Terramaid

A utility for creating Mermaid diagrams from Terraform configurations

Introduction

Terramaid transforms your Terraform resources and plans into visually appealing Mermaid diagrams. By converting complex infrastructure into easy-to-understand diagrams, Terramaid enhances documentation, simplifies review processes, and fosters better collaboration among team members. Whether you're looking to enrich your project's documentation, streamline reviews, or just bring a new level of clarity to your Terraform configurations, Terramaid is the perfect utility to integrate into your development workflow.

Demo

Output
flowchart TD
 subgraph Hashicorp
 subgraph Terraform
  aws_db_instance.example_db["aws_db_instance.example_db"]
  aws_instance.example_instance["aws_instance.example_instance"]
  aws_s3_bucket.logs["aws_s3_bucket.logs"]
  aws_s3_bucket.test["aws_s3_bucket.test"]
  aws_s3_bucket_policy.logs_policy["aws_s3_bucket_policy.logs_policy"]
  aws_s3_bucket_policy.test_policy["aws_s3_bucket_policy.test_policy"]
  aws_s3_bucket_policy.logs_policy --> aws_s3_bucket.logs
  aws_s3_bucket_policy.test_policy --> aws_s3_bucket.test
 end
 end

Installation

Homebrew installation:

brew install terramaid

If you have a functional go environment, you can install with:

go install github.com/RoseSecurity/terramaid@latest

Build from source:

git clone git@github.com:RoseSecurity/terramaid.git
cd terramaid
make build
Usage

terramaid can be configured using CLI parameters and environment variables.

[!NOTE] CLI parameters take precedence over environment variables.

The following configuration options are available:

> terramaid -h
A utility for generating Mermaid diagrams from Terraform

Usage:
  terramaid [flags]
  terramaid [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  version     Print the CLI version

Flags:
  -r, --direction string       Specify the direction of the flowchart (env: TERRAMAID_DIRECTION) (default "TD")
  -h, --help                   help for terramaid
  -o, --output string          Output file for Mermaid diagram (env: TERRAMAID_OUTPUT) (default "Terramaid.md")
  -s, --subgraph-name string   Specify the subgraph name of the flowchart (env: TERRAMAID_SUBGRAPH_NAME) (default "Terraform")
  -b, --tf-binary string       Path to Terraform binary (env: TERRAMAID_TF_BINARY)
  -d, --tf-dir string          Path to Terraform directory (env: TERRAMAID_TF_DIR) (default ".")
  -p, --tf-plan string         Path to Terraform plan file (env: TERRAMAID_TF_PLAN)
  -w, --working-wir string     Working directory for Terraform (env: TERRAMAID_WORKING_DIR) (default ".")

Use "terramaid [command] --help" for more information about a command.
Docker Image

Run the following command to utilize the Terramaid Docker image:

docker run -it -v $(pwd):/usr/src/terramaid rosesecurity/terramaid:latest

CI/CD Integrations

Terramaid is designed to easily integrate with existing pipelines and workflows. For more information on sample GitHub Actions and GitLab CI/CD Pipelines, feel free to check out GitHub Actions Integrations and Gitlab Pipelines Integrations.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL