### Install Terramaid via Go Source: https://context7.com/rosesecurity/terramaid/llms.txt Installs Terramaid directly using the Go toolchain. Ensure Go is installed and configured on your system. ```bash # Install directly with Go go install github.com/RoseSecurity/terramaid@latest ``` -------------------------------- ### Installation via Apt Source: https://github.com/rosesecurity/terramaid/blob/main/README.md Commands to configure the repository and install Terramaid on Debian-based systems. ```sh curl -1sLf \ 'https://dl.cloudsmith.io/public/rosesecurity/terramaid/setup.deb.sh' \ | sudo -E bash ``` ```sh apt install terramaid= ``` -------------------------------- ### Installation from Source Source: https://github.com/rosesecurity/terramaid/blob/main/README.md Steps to clone the repository and build the binary from source. ```sh git clone git@github.com:RoseSecurity/terramaid.git cd terramaid make build ``` -------------------------------- ### Installation via Nix Source: https://github.com/rosesecurity/terramaid/blob/main/README.md Commands for running or installing Terramaid using the Nix package manager. ```bash # Using nix run (no installation required) nix run github:RoseSecurity/terramaid run # Install globally with Nix flakes nix profile install github:RoseSecurity/Terramaid # Add to your system configuration or home-manager # In your flake.nix inputs: inputs.Terramaid.url = "github:RoseSecurity/Terramaid"; # Then add to your packages: inputs.Terramaid.packages.${system}.default ``` -------------------------------- ### Install Terramaid via Apt Source: https://context7.com/rosesecurity/terramaid/llms.txt Installs Terramaid on Debian/Ubuntu systems using the apt package manager. Requires setting up a custom repository. ```bash # Setup the repository curl -1sLf \ 'https://dl.cloudsmith.io/public/rosesecurity/terramaid/setup.deb.sh' \ | sudo -E bash # Install a specific version apt install terramaid= ``` -------------------------------- ### Installation via Homebrew and Go Source: https://github.com/rosesecurity/terramaid/blob/main/README.md Commands to install Terramaid using Homebrew or a Go environment. ```sh brew install terramaid ``` ```sh go install github.com/RoseSecurity/terramaid@latest ``` -------------------------------- ### Mermaid Diagram Output Example Source: https://context7.com/rosesecurity/terramaid/llms.txt Example of a Mermaid flowchart generated from an AWS Terraform configuration showing resource dependencies. ```mermaid flowchart TD subgraph Terraform subgraph Aws aws_db_instance.main_db["aws_db_instance.main_db"] aws_instance.app_server["aws_instance.app_server"] aws_instance.web_server["aws_instance.web_server"] aws_lb.web["aws_lb.web"] aws_lb_listener.web["aws_lb_listener.web"] aws_lb_target_group.web["aws_lb_target_group.web"] aws_lb_target_group_attachment.web["aws_lb_target_group_attachment.web"] aws_s3_bucket.logs["aws_s3_bucket.logs"] aws_security_group.db["aws_security_group.db"] aws_security_group.web["aws_security_group.web"] aws_subnet.private["aws_subnet.private"] aws_subnet.public["aws_subnet.public"] aws_vpc.main["aws_vpc.main"] end aws_lb.web --> aws_security_group.web aws_lb.web --> aws_subnet.public aws_lb_listener.web --> aws_lb.web aws_lb_listener.web --> aws_lb_target_group.web aws_lb_target_group.web --> aws_vpc.main aws_lb_target_group_attachment.web --> aws_instance.web_server aws_lb_target_group_attachment.web --> aws_lb_target_group.web aws_security_group.db --> aws_security_group.web aws_security_group.web --> aws_vpc.main aws_subnet.private --> aws_vpc.main aws_subnet.public --> aws_vpc.main end ``` -------------------------------- ### Persist zsh completions for new sessions Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_zsh.md Commands to install completion scripts permanently for Linux and macOS environments. ```bash terramaid completion zsh > "${fpath[1]}/_terramaid" ``` ```bash terramaid completion zsh > $(brew --prefix)/share/zsh/site-functions/_terramaid ``` -------------------------------- ### Run Terramaid - Working Directory and Binary Path Source: https://context7.com/rosesecurity/terramaid/llms.txt Specifies the Terraform working directory and the path to the Terraform binary, useful for complex project structures or custom installations. ```bash # Specify working directory and Terraform binary path terramaid run --working-dir ./infrastructure --tf-binary /usr/local/bin/terraform ``` -------------------------------- ### Install Terramaid via Homebrew Source: https://context7.com/rosesecurity/terramaid/llms.txt Installs Terramaid using the Homebrew package manager. This is a convenient method for macOS and Linux users. ```bash # Install using Homebrew (macOS/Linux) brew install terramaid ``` -------------------------------- ### Configure Terramaid GitHub Actions Workflow Source: https://github.com/rosesecurity/terramaid/blob/main/docs/GitHub_Actions_Integration.md Automates the installation of Terramaid and execution of Terraform checks on pull requests. Requires appropriate repository permissions to write comments to pull requests. ```yaml name: Terramaid on: pull_request: paths: - '**/*.tf' jobs: run-terraform-check: permissions: pull-requests: write runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Outputs id: vars run: | echo "terramaid_version=$(curl -s https://api.github.com/repos/RoseSecurity/Terramaid/releases/latest | grep tag_name | cut -d '"' -f 4)" >> $GITHUB_OUTPUT case "${{ runner.arch }}" in "X64" ) echo "arch=x86_64" >> $GITHUB_OUTPUT ;; "ARM64" ) echo "arch=arm64" >> $GITHUB_OUTPUT ;; esac - name: Setup Go uses: actions/setup-go@v5 with: go-version: 'stable' - name: Setup Terramaid run: | curl -L -o /tmp/terramaid.tar.gz "https://github.com/RoseSecurity/Terramaid/releases/download/${{ steps.vars.outputs.terramaid_version }}/Terramaid_Linux_${{ steps.vars.outputs.arch }}.tar.gz" tar -xzvf /tmp/terramaid.tar.gz -C /tmp mv -v /tmp/Terramaid /usr/local/bin/terramaid chmod +x /usr/local/bin/terramaid - name: Init run: terraform init - name: Terramaid id: terramaid run: | /usr/local/bin/terramaid run - name: Upload comment to PR uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const fs = require('fs'); const terramaid = fs.readFileSync('Terramaid.md', 'utf8'); github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body: `## Terraform Plan\n\n${terramaid}` }) ``` -------------------------------- ### Generate Bash Completion Script Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_bash.md Use this command to generate the autocompletion script for bash. Ensure 'bash-completion' is installed. ```bash terramaid completion bash ``` -------------------------------- ### Check Terramaid Version Source: https://context7.com/rosesecurity/terramaid/llms.txt Displays the current installed version of Terramaid and checks for any newer releases available on GitHub. ```bash # Check current version terramaid version # Output: terramaid: 1.0.0 ``` -------------------------------- ### Mermaid Diagram Output Source: https://github.com/rosesecurity/terramaid/blob/main/README.md Example of the Mermaid flowchart syntax generated by Terramaid for AWS infrastructure resources. ```mermaid flowchart TD subgraph Terraform subgraph Aws aws_db_instance.main_db["aws_db_instance.main_db"] aws_instance.app_server["aws_instance.app_server"] aws_instance.web_server["aws_instance.web_server"] aws_lb.web["aws_lb.web"] aws_lb_listener.web["aws_lb_listener.web"] aws_lb_target_group.web["aws_lb_target_group.web"] aws_lb_target_group_attachment.web["aws_lb_target_group_attachment.web"] 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_security_group.db["aws_security_group.db"] aws_security_group.web["aws_security_group.web"] aws_subnet.private["aws_subnet.private"] aws_subnet.public["aws_subnet.public"] aws_vpc.main["aws_vpc.main"] end aws_lb.web --> aws_security_group.web aws_lb.web --> aws_subnet.public aws_lb_listener.web --> aws_lb.web aws_lb_listener.web --> aws_lb_target_group.web aws_lb_target_group.web --> aws_vpc.main aws_lb_target_group_attachment.web --> aws_instance.web_server aws_lb_target_group_attachment.web --> aws_lb_target_group.web aws_s3_bucket_policy.logs_policy --> aws_s3_bucket.logs aws_s3_bucket_policy.test_policy --> aws_s3_bucket.test aws_security_group.db --> aws_security_group.web aws_security_group.web --> aws_vpc.main aws_subnet.private --> aws_vpc.main aws_subnet.public --> aws_vpc.main end ``` -------------------------------- ### Load PowerShell Completions Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_powershell.md This command loads the autocompletion script into your current PowerShell session. Ensure Terramaid is installed and accessible in your PATH. ```powershell terramaid completion powershell | Out-String | Invoke-Expression ``` -------------------------------- ### GitLab CI/CD Pipeline Integration for Terramaid Source: https://context7.com/rosesecurity/terramaid/llms.txt Integrate Terramaid into GitLab CI/CD pipelines to automatically comment Mermaid diagrams on merge requests. This setup uses Docker, requires GitLab CI variables for authentication, and posts the generated diagram as a note on the merge request. ```yaml terramaid: image: docker:latest stage: test services: - docker:dind variables: DOCKER_HOST: tcp://docker:2375/ DOCKER_DRIVER: overlay2 rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH when: never - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: on_success script: - apk update && apk add curl jq - docker run -v $(pwd):/usr/src/terramaid rosesecurity/terramaid:latest run - | content=$(cat Terramaid.md) escaped_content=$(echo "$content" | jq -sRr @json) curl --location --request POST "https://gitlab.com/api/v4/projects/$CI_MERGE_REQUEST_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes" \ --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ --header "Content-Type: application/json" \ --data "{\"body\": $escaped_content}" ``` -------------------------------- ### Version command help options Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_version.md Displays help information for the version command. ```bash -h, --help help for version ``` -------------------------------- ### Run Terramaid - Using Terraform Plan File Source: https://context7.com/rosesecurity/terramaid/llms.txt Generates a diagram based on a pre-existing Terraform plan file instead of the current configuration. ```bash # Use a specific Terraform plan file terraform plan -out=tfplan terramaid run --tf-plan tfplan --output planned-changes.md ``` -------------------------------- ### View Terramaid CLI Help Source: https://github.com/rosesecurity/terramaid/blob/main/README.md Displays available configuration flags and environment variables for the run command. ```sh > terramaid run -h Generate Mermaid diagrams from Terraform configurations Usage: terramaid run [flags] Flags: -c, --chart-type string Specify the type of Mermaid chart to generate (env: TERRAMAID_CHART_TYPE) (default "flowchart") -r, --direction string Specify the direction of the diagram (env: TERRAMAID_DIRECTION) (default "TD") -h, --help help for run -o, --output string Output file for Mermaid diagram (env: TERRAMAID_OUTPUT) (default "Terramaid.md") -s, --subgraph-name string Specify the subgraph name of the diagram (env: TERRAMAID_SUBGRAPH_NAME) (default "Terraform") -b, --tf-binary string Path to Terraform binary (env: TERRAMAID_TF_BINARY) -p, --tf-plan string Path to Terraform plan file (env: TERRAMAID_TF_PLAN) -w, --working-dir string Working directory for Terraform (env: TERRAMAID_WORKING_DIR) (default ".") -v, --verbose bool Verbose output to terminal (env: TERRAMAID_VERBOSE) (default false) Use "terramaid [command] --help" for more information about a command. ``` -------------------------------- ### Resource Filtering - Combined Filters Source: https://context7.com/rosesecurity/terramaid/llms.txt Demonstrates combining multiple filtering options (providers, types, modules, and resource-only mode) for a highly customized diagram. ```bash # Combine multiple filters terramaid run \ --include-providers aws \ --exclude-types "aws_iam_*" \ --exclude-modules "deprecated" \ --resources-only \ --output filtered.md ``` -------------------------------- ### Display Terramaid Help Information Source: https://github.com/rosesecurity/terramaid/blob/main/docs/Getting_Started.md Run this command to display the help information for Terramaid, showing available options and usage. ```sh cd test && terramaid -h ``` -------------------------------- ### Configure Custom Resource Detection Source: https://context7.com/rosesecurity/terramaid/llms.txt Use environment variables to define custom provider prefixes and regex patterns for resource type matching. ```bash # Add custom provider prefixes for resource detection export TERRAMAID_RESOURCE_TYPE_PREFIXES="mycustomprovider,acme,internal" # Use a custom regex pattern for resource type matching export TERRAMAID_RESOURCE_TYPE_REGEX="^(custom|internal)_[a-z]+" # Run with custom detection terramaid run --verbose ``` -------------------------------- ### Enable zsh completion initialization Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_zsh.md Run this command once to enable shell completion in your environment if it is not already configured. ```bash echo "autoload -U compinit; compinit" >> ~/.zshrc ``` -------------------------------- ### Command usage syntax Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_fish.md The basic syntax for invoking the fish completion command. ```bash terramaid completion fish [flags] ``` -------------------------------- ### Build Terramaid from Source Source: https://context7.com/rosesecurity/terramaid/llms.txt Builds Terramaid from its source code. This involves cloning the repository and running the make build command. ```bash # Clone and build git clone git@github.com:RoseSecurity/terramaid.git cd terramaid make build ``` -------------------------------- ### Run Terramaid - Basic Usage Source: https://context7.com/rosesecurity/terramaid/llms.txt Generates a Mermaid diagram from Terraform configuration in the current directory. The output is saved to Terramaid.md by default. ```bash # Basic usage - generates Terramaid.md in current directory cd /path/to/terraform/project terraform init terramaid run ``` -------------------------------- ### Load fish completions in current session Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_fish.md Execute this command to immediately enable autocompletion for the current shell session. ```bash terramaid completion fish | source ``` -------------------------------- ### Inherited parent command options Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_zsh.md Global flags available to the command. ```bash -v, --verbose Enable verbose output ``` -------------------------------- ### Fish completion options Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_fish.md Available flags for customizing the fish completion output. ```bash -h, --help help for fish --no-descriptions disable completion descriptions ``` -------------------------------- ### Run Terramaid - Output and Direction Source: https://context7.com/rosesecurity/terramaid/llms.txt Specifies the output filename and the diagram's layout direction (e.g., Left-to-Right). ```bash # Specify output file and diagram direction (LR = left-to-right) terramaid run --output infrastructure.md --direction LR ``` -------------------------------- ### terramaid version command syntax Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_version.md Defines the command structure for checking the version. ```bash terramaid version [flags] ``` -------------------------------- ### Persist fish completions for new sessions Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_fish.md Redirect the output to the fish completions directory to ensure autocompletion is available in all future sessions. ```bash terramaid completion fish > ~/.config/fish/completions/terramaid.fish ``` -------------------------------- ### Environment Variables vs CLI Flags Source: https://context7.com/rosesecurity/terramaid/llms.txt Shows how to run Terramaid using environment variable configurations and demonstrates that CLI flags take precedence over environment variables. ```bash # Run with environment configuration terramaid run # CLI flags override environment variables terramaid run --direction TD # Overrides TERRAMAID_DIRECTION ``` -------------------------------- ### Resource Filtering - Include Types Source: https://context7.com/rosesecurity/terramaid/llms.txt Generates a diagram including only specified resource types. Supports glob patterns for flexible matching. ```bash # Include only specific resource types (supports glob patterns) terramaid run --include-types "aws_instance,aws_s3*" --output ec2-s3.md ``` -------------------------------- ### Resource Filtering - Include Providers Source: https://context7.com/rosesecurity/terramaid/llms.txt Filters the diagram to show resources only from specified cloud providers. ```bash # Filter by provider - only show AWS resources terramaid run --include-providers aws --output aws-only.md ``` ```bash # Filter by provider - show AWS and Google Cloud resources terramaid run --include-providers aws,google --output multi-cloud.md ``` -------------------------------- ### terramaid completion zsh command usage Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_zsh.md Basic syntax for the completion command. ```bash terramaid completion zsh [flags] ``` -------------------------------- ### Terramaid Docs Command Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_docs.md Use this command to generate documentation for the terramaid CLI. No specific flags are detailed here. ```bash terramaid docs [flags] ``` -------------------------------- ### Run Terramaid with Docker Source: https://context7.com/rosesecurity/terramaid/llms.txt Execute Terramaid using its official Docker image. Mount your current directory to access Terraform files and specify desired options or environment variables. ```bash # Basic Docker usage - mount current directory docker run -it -v $(pwd):/usr/src/terramaid rosesecurity/terramaid:latest run ``` ```bash # With custom options docker run -it -v $(pwd):/usr/src/terramaid rosesecurity/terramaid:latest run \ --direction LR \ --subgraph-name "My Infrastructure" \ --output diagram.md ``` ```bash # Using environment variables with Docker docker run -it \ -e TERRAMAID_DIRECTION=LR \ -e TERRAMAID_OUTPUT=infra.md \ -v $(pwd):/usr/src/terramaid \ rosesecurity/terramaid:latest run ``` -------------------------------- ### Display terramaid version Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_version.md Executes the version command to print the CLI version information. ```bash terramaid version ``` -------------------------------- ### Run Terramaid - Subgraph and Direction Source: https://context7.com/rosesecurity/terramaid/llms.txt Customizes the subgraph name and sets the diagram direction to Top-Down, saving the output to a specified file. ```bash # Custom subgraph name and top-down direction terramaid run --subgraph-name "AWS Infrastructure" --direction TD --output diagram.md ``` -------------------------------- ### Load zsh completions in current session Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_zsh.md Execute this command to load completions immediately into the active shell session. ```bash source <(terramaid completion zsh) ``` -------------------------------- ### Load Bash Completion Temporarily Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_bash.md Source the output of the completion command to load autocompletions in the current shell session. ```bash source <(terramaid completion bash) ``` -------------------------------- ### terramaid completion zsh options Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_zsh.md Available flags for the zsh completion command. ```bash -h, --help help for zsh --no-descriptions disable completion descriptions ``` -------------------------------- ### Run Terramaid - Verbose Output Source: https://context7.com/rosesecurity/terramaid/llms.txt Enables verbose logging during diagram generation, which is helpful for debugging issues with large or complex configurations. ```bash # Enable verbose output for debugging terramaid run --verbose --output debug-diagram.md ``` -------------------------------- ### terramaid version Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_version.md Prints the Terramaid CLI version. ```APIDOC ## terramaid version ### Description This command prints the CLI version. ### Synopsis ``` terramaid version [flags] ``` ### Examples ``` terramaid version ``` ### Options ``` -h, --help help for version ``` ### Options inherited from parent commands ``` -v, --verbose Enable verbose output ``` ### SEE ALSO * [terramaid](terramaid.md) - A utility for generating Mermaid diagrams from Terraform configurations ``` -------------------------------- ### terramaid run Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_run.md Generates Mermaid diagrams from Terraform configurations. ```APIDOC ## terramaid run ### Description Generate Mermaid diagrams from Terraform configurations. ### Method CLI Command ### Endpoint terramaid run [flags] ### Parameters #### Query Parameters - **chart-type** (string) - Optional - Specify the type of Mermaid chart to generate (env: TERRAMAID_CHART_TYPE) (default "flowchart") - **direction** (string) - Optional - Specify the direction of the diagram (env: TERRAMAID_DIRECTION) (default "TD") - **output** (string) - Optional - Output file for Mermaid diagram (env: TERRAMAID_OUTPUT) (default "Terramaid.md") - **subgraph-name** (string) - Optional - Specify the subgraph name of the diagram (env: TERRAMAID_SUBGRAPH_NAME) (default "Terraform") - **tf-binary** (string) - Optional - Path to Terraform binary (env: TERRAMAID_TF_BINARY) - **tf-plan** (string) - Optional - Path to Terraform plan file (env: TERRAMAID_TF_PLAN) - **timeout** (duration) - Optional - Timeout for the entire run (e.g. 5m) (env: TERRAMAID_TIMEOUT) - **verbose** (boolean) - Optional - Enable verbose output (env: TERRAMAID_VERBOSE) - **working-dir** (string) - Optional - Working directory for Terraform (env: TERRAMAID_WORKING_DIR) (default ".") ### SEE ALSO * [terramaid](terramaid.md) - A utility for generating Mermaid diagrams from Terraform configurations ``` -------------------------------- ### Load Bash Completion Permanently on macOS Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_bash.md Redirect the output to the appropriate directory for bash-completion on macOS using Homebrew. A new shell session is required for this to take effect. ```bash terramaid completion bash > $(brew --prefix)/etc/bash_completion.d/terramaid ``` -------------------------------- ### CLI Command: terramaid docs Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_docs.md Documentation for the 'docs' command used to generate documentation for the CLI. ```APIDOC ## CLI COMMAND: terramaid docs ### Description Generates documentation for the Terramaid CLI. ### Usage `terramaid docs [flags]` ### Options - **-h, --help** (boolean) - Optional - Displays help information for the docs command. ``` -------------------------------- ### Load Bash Completion Permanently on Linux Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_bash.md Redirect the output to a file in /etc/bash_completion.d/ for persistent autocompletion on Linux systems. A new shell session is required for this to take effect. ```bash terramaid completion bash > /etc/bash_completion.d/terramaid ``` -------------------------------- ### Run Terramaid - Timeout Configuration Source: https://context7.com/rosesecurity/terramaid/llms.txt Sets a timeout duration for the diagram generation process, preventing excessively long runs on very large Terraform projects. ```bash # Set a timeout for large configurations terramaid run --timeout 5m --output large-infra.md ``` -------------------------------- ### Run Terramaid via Docker Source: https://github.com/rosesecurity/terramaid/blob/main/README.md Executes Terramaid using the official Docker image, mounting the current directory to the container. ```sh docker run -it -v $(pwd):/usr/src/terramaid rosesecurity/terramaid:latest run ``` -------------------------------- ### Help Flag for Docs Command Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_docs.md The help flag provides assistance for the 'docs' command. It is a standard flag available for most CLI commands. ```bash -h, --help help for docs ``` -------------------------------- ### Terramaid Completion PowerShell Options Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_powershell.md Options for the terramaid completion powershell command. Use --no-descriptions to disable completion descriptions. ```bash -h, --help help for powershell --no-descriptions disable completion descriptions ``` -------------------------------- ### View Generated Visualization File Source: https://github.com/rosesecurity/terramaid/blob/main/docs/Getting_Started.md This command displays the content of the generated Terramaid visualization file. ```sh cat Terramaid_Demo.md ``` -------------------------------- ### Generate Terramaid Visualization Source: https://github.com/rosesecurity/terramaid/blob/main/docs/Getting_Started.md Use this command to generate a visualization of your Terraform project. Specify the subgraph name, direction, and output file name. ```sh terramaid --subgraph-name Demo --direction LR --output Terramaid_Demo.md ``` -------------------------------- ### Run Terramaid - Resources Only Source: https://context7.com/rosesecurity/terramaid/llms.txt Filters the diagram to include only resource nodes, excluding providers, variables, and other non-resource elements. ```bash # Filter to only show resource nodes (exclude providers, variables, etc.) terramaid run --resources-only --output resources.md ``` -------------------------------- ### Environment Variables Configuration - General Source: https://context7.com/rosesecurity/terramaid/llms.txt Sets default configuration options for Terramaid using environment variables. These can be overridden by CLI flags. ```bash # Set defaults via environment variables export TERRAMAID_OUTPUT="infrastructure.md" export TERRAMAID_DIRECTION="LR" export TERRAMAID_SUBGRAPH_NAME="Production" export TERRAMAID_CHART_TYPE="flowchart" export TERRAMAID_WORKING_DIR="./terraform" export TERRAMAID_TF_BINARY="/usr/local/bin/terraform" export TERRAMAID_VERBOSE="true" export TERRAMAID_RESOURCES_ONLY="true" export TERRAMAID_TIMEOUT="10m" ``` -------------------------------- ### Configure Terramaid GitLab CI/CD Stage Source: https://github.com/rosesecurity/terramaid/blob/main/docs/GitLab_Pipelines_Integration.md Defines a pipeline stage that runs Terramaid in a Docker container and posts the output as a comment on the relevant merge request. ```yaml terramaid: image: docker:latest stage: test services: - docker:dind variables: DOCKER_HOST: tcp://docker:2375/ DOCKER_DRIVER: overlay2 rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH when: never - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: on_success script: - apk update && apk add curl jq - docker run -v $(pwd):/usr/src/terramaid run rosesecurity/terramaid:latest - | content=$(cat Terramaid.md) escaped_content=$(echo "$content" | jq -sRr @json) echo "Content read from Terramaid.md: $content" echo "GITLAB_TOKEN length: ${#GITLAB_TOKEN}" echo "Escaped content: $escaped_content" curl --verbose --location --request POST "https://gitlab.com/api/v4/projects/$CI_MERGE_REQUEST_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes" \ --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ --header "Content-Type: application/json" \ --data "{\"body\": $escaped_content}" ``` -------------------------------- ### Environment Variables Configuration - Filtering Source: https://context7.com/rosesecurity/terramaid/llms.txt Configures resource filtering options for Terramaid using environment variables, allowing for consistent filtering across multiple runs. ```bash # Filtering via environment variables export TERRAMAID_INCLUDE_TYPES="aws_*,google_*" export TERRAMAID_EXCLUDE_TYPES="aws_iam_*" export TERRAMAID_INCLUDE_PROVIDERS="aws,google" export TERRAMAID_EXCLUDE_MODULES="legacy,deprecated" ``` -------------------------------- ### Generate Fish Shell Autocompletion Script Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_fish.md This command generates the autocompletion script for the fish shell. It can be loaded into the current session or saved to a file for persistent use. ```APIDOC ## terramaid completion fish ### Description Generate the autocompletion script for the fish shell. ### Synopsis To load completions in your current shell session: ```bash terramaid completion fish | source ``` To load completions for every new session, execute once: ```bash terramaid completion fish > ~/.config/fish/completions/terramaid.fish ``` You will need to start a new shell for this setup to take effect. ```bash terramaid completion fish [flags] ``` ### Options ``` -h, --help help for fish --no-descriptions disable completion descriptions ``` ### Options inherited from parent commands ``` -v, --verbose Enable verbose output ``` ### SEE ALSO * [terramaid completion](terramaid_completion.md) - Generate the autocompletion script for the specified shell ``` -------------------------------- ### Terramaid Completion PowerShell Command Structure Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_powershell.md This is the basic structure for generating PowerShell autocompletion scripts. Flags can be added to modify the output, such as disabling descriptions. ```bash terramaid completion powershell [flags] ``` -------------------------------- ### Resource Filtering - Exclude Types Source: https://context7.com/rosesecurity/terramaid/llms.txt Generates a diagram excluding specified resource types. Useful for simplifying diagrams by omitting certain categories of resources. ```bash # Exclude specific resource types terramaid run --exclude-types "aws_iam_*,aws_cloudwatch_*" --output no-iam.md ``` -------------------------------- ### Set Diagram Layout Direction Source: https://context7.com/rosesecurity/terramaid/llms.txt Specify the flowchart layout direction using the --direction flag. ```bash # Top to Bottom (default) terramaid run --direction TD # or TB # Bottom to Top terramaid run --direction BT # Left to Right terramaid run --direction LR # Right to Left terramaid run --direction RL ``` -------------------------------- ### Generate Shell Autocompletion Scripts Source: https://context7.com/rosesecurity/terramaid/llms.txt Generates shell autocompletion scripts for bash, zsh, fish, and PowerShell to enable tab completion for Terramaid commands and flags. Ensure the output path is correct for your shell. ```bash # Generate bash completion script terramaid completion bash > /etc/bash_completion.d/terramaid ``` ```bash # Generate zsh completion terramaid completion zsh > "${fpath[1]}/_terramaid" ``` ```bash # Generate fish completion terramaid completion fish > ~/.config/fish/completions/terramaid.fish ``` ```bash # Generate PowerShell completion terramaid completion powershell > terramaid.ps1 ``` -------------------------------- ### Generate PowerShell Autocompletion Script Source: https://github.com/rosesecurity/terramaid/blob/main/docs/terramaid_completion_powershell.md Use this command to generate the autocompletion script for PowerShell. Load completions in your current shell session by piping the output to Invoke-Expression. For persistent completions, add this to your PowerShell profile. ```bash terramaid completion powershell ``` -------------------------------- ### Resource Filtering - Exclude Modules Source: https://context7.com/rosesecurity/terramaid/llms.txt Excludes resources belonging to specified Terraform modules from the generated diagram. ```bash # Exclude specific modules from the diagram terramaid run --exclude-modules "monitoring,logging" --output core-infra.md ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.