terraform-provider-cato

command module
v0.0.73 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

Terraform CATO Provider

Maintainers

This provider plugin is maintained by the team at Cato.

Requirements

  • Terraform 0.12.x
  • Go 1.25.0 (to build the provider plugin)

Building The Provider

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-cato

git clone git@github.com:catonetworks/terraform-provider-cato.git $GOPATH/src/github.com/terraform-providers/terraform-provider-cato

Enter the provider directory and build the provider

cd $GOPATH/src/github.com/terraform-providers/terraform-provider-cato
make build

Using the Provider

Set the following 2 environment variables:

export TF_VAR_token="abcde12345abcde12345"
export TF_VAR_account_id="12345"

Optional retry configuration:

export CATO_RETRY_MAX="5"
export CATO_RETRY_WAIT_MIN_SECONDS="1"
export CATO_RETRY_WAIT_MAX_SECONDS="30"

Sample terraform files can be found in the examples folder in this repository. You can initialize and run these terraform files with the following commands:

terraform init
terraform plan
terraform apply --auto-approve

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.11+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

make install
...
$GOPATH/bin/terraform-provider-cato
...

In order to test the provider, you can simply run make test.

make test

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create real resources, and often cost money to run.

make testacc

Helpful Terraform Aliases (Unix & Windows)

This guide explains how to create persistent Terraform helper aliases on:

  • macOS / Linux (bash or zsh)
  • Windows PowerShell
  • Windows Git Bash

macOS / Linux (bash or zsh)

1. Open your shell config file
Bash
nano ~/.bashrc
Zsh (default on macOS)
nano ~/.zshrc

2. Add the aliases
alias tf='terraform'
alias tfap='terraform apply --auto-approve'
alias tfapp='terraform apply --auto-approve -parallelism=1'
alias tfdap='terraform destroy --auto-approve'
alias tfdapp='terraform destroy --auto-approve -parallelism=1'
alias tfclear='rm -rf .terraform* && rm terraform.tfstate*'
alias tftestapp='terraform test -parallelism=1'
alias tfdocs="terraform-docs markdown . --output-file README.md"
alias tfdebugon="export TF_LOG=DEBUG && export TF_LOG_PATH=~/Downloads/error_log.txt"
alias tfdebugoff="unset TF_LOG && unset TF_LOG_PATH"
alias tffmt="terraform fmt -recursive"

3. Reload your shell
source ~/.bashrc

or

source ~/.zshrc

Your aliases are now persistent.


PowerShell requires functions instead of bash-style aliases.

1. Open your PowerShell profile
notepad $PROFILE

If it does not exist:

New-Item -ItemType File -Path $PROFILE -Force
notepad $PROFILE

2. Add the functions
function tf { terraform @args }

function tfap { terraform apply --auto-approve @args }

function tfapp { terraform apply --auto-approve -parallelism=1 @args }

function tfdap { terraform destroy --auto-approve @args }

function tfdapp { terraform destroy --auto-approve -parallelism=1 @args }

function tfclear {
    Remove-Item -Recurse -Force .terraform* -ErrorAction SilentlyContinue
    Remove-Item -Force terraform.tfstate* -ErrorAction SilentlyContinue
}

function tftestapp { terraform test -parallelism=1 @args }

function tfdocs {
    terraform-docs markdown . --output-file README.md
}

function tfdebugon {
    $env:TF_LOG="DEBUG"
    $env:TF_LOG_PATH="$HOME\tf_error_log.txt"
}

function tfdebugoff {
    Remove-Item Env:TF_LOG -ErrorAction SilentlyContinue
    Remove-Item Env:TF_LOG_PATH -ErrorAction SilentlyContinue
}

function tffmt {
    terraform fmt -recursive
}

3. Restart PowerShell

Close and reopen your terminal to apply changes.

Your aliases are now persistent.


Windows -- Git Bash

If using Git Bash on Windows, follow the macOS/Linux instructions and edit:

nano ~/.bashrc

Then reload:

source ~/.bashrc

Verification

Test with:

tf --version
tfap

If Terraform runs, your aliases are working.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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