Skip to content

DevOps/CloudOps CLI framework for making work with Terragrunt and performing various cloud operations much easier.

License

Notifications You must be signed in to change notification settings

devops-infra/velez

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Velez

DevOps/CloudOps CLI framework for making work with Terragrunt and performing various cloud operations much easier.

Do you want to automate your daily tasks with Terragrunt, Terraform, GitHub, and other tools? Velez is here to help you!

Do you sometimes forget to add changed files before pushing to GitHub? Velez will do that for you and even format HCL files before committing!

Gitmoji

Disclaimer

This project is in the early development stage and is not ready for production use. It is a work in progress and may contain bugs, incomplete features, incorrect documentation, backward incompatible changes or other issues. Use it at your own risk.

Since it operates on the infrastructure, user is responsible for the consequences of the actions taken by the tool and should review the code before using it.

Velez

Features

Supporting following services/tools and operations on them:

  • Terragrunt operations -tg:
    • Walk directory structure containing Terragrunt modules.
    • Run Plan, Apply, Destroy and Output on a selected module or a specific target.
    • Taint and Untaint a resource.
    • Unlock module and show lock information.
    • Run Validate and Refresh on a selected module.
    • Import a resource to the state.
    • Run State operations, like list, move, remove, show, pull and push.
    • Run Module operations on source modules:
      • Move a module to a new directory, including moving remote state.
      • Destroy resources and backend of the module.
      • Destroy backend of the module.
  • File operations -f:
    • Formatting all HCL files in the project.
    • Cleaning up temporary files in the project or a selected module.
  • GitHub operations -gh:
    • Source operations, like commit, amend, push, pull or rebase.
    • Branch operations, like create, change local or remote, delete local or remote.
    • Manage pull requests, like create, list in the repository or the whole organization.
    • Manage issues, like create, list in the repository or the whole organization.
    • Easily remove stale branches.

Installation

Framework is written in Python and can be installed as a package.

  1. Clone the repository:

    git clone https://github.com/devops-infra/velez.git
  2. Navigate to the project directory:

    cd velez
  3. Install other dependencies:

    • Install Python if not installed yet - required.
    • Install Terragrunt, and Terraform or OpenTofu - required for IaaC operations.
    • Install hcledit - required for updating .hcl files.
    • Install direnv or similar solution - highly suggested for managing environments.

    It can be installed, e.g. by running:

    brew install python
    brew install terraform
    brew install terragrunt
    brew install direnv
    brew install minamijoyo/hcledit/hcledit
  4. Install the package:

    pip install .

Usage

Help

Run the CLI with the --help argument to see the available commands:

velez --help

To use the Velez CLI, you have three options:

Interactive Menu

Run the CLI without additional arguments to use the interactive menu:

velez

Interactive Menu for specific operation

Terragrunt operations (-tg or --terragrunt)

velez --terragrunt <operation> <module> <other-arguments>

File operations (-f or --file)

Show menu for file operations:

velez --file

GitHub operations (-gh or --github)

Show menu for GitHub operations:

velez --github

Automation / CLI

Run the CLI with additional arguments for automation/scripting:

Terragrunt operations (-tg or --terragrunt)

velez --terragrunt <operation> <module> <other-arguments>

Where:

  • <operation> is a Terraform/Terragrunt operation to perform, e.g. plan.
  • <module> is a relative path to a Terragrunt module to operate on, e.g. aws/dev-account.
  • <other-arguments> are additional arguments for the Terraform and Terragrunt operations, e.g. --target=module.resource.

For example for the following directory structure:

. 
β”œβ”€β”€ aws
β”‚   β”œβ”€β”€ dev-account
β”‚   β”‚   └── terragrunt.hcl
β”‚   β”œβ”€β”€ prod-account
β”‚   β”‚   └── terragrunt.hcl
β”‚   └── aws.hcl
β”œβ”€β”€ .env
└── root.hcl

Run the following command to plan the aws/dev-account module:

velez -tg plan aws/dev-account

Configuration

Velez expects following environment variables to be set:

Variable Description Required for operations Default
VELEZ_TG_ROOT_HCL Relative path to the Terragrunt configuration file. Terragrunt root.hcl
VELEZ_TG_TEMP_CONFIG Absolute path to a temporary file created to render Terragrunt configuration. Terragrunt /tmp/terragrunt.hcl
GITHUB_TOKEN GitHub token for accessing the GitHub API. GitHub N/A
VELEZ_GH_STALE_BRANCHES_DAYS Number of days after which branches are considered stale. GitHub 45
VELEZ_GH_STALE_BRANCHES_COMMITS Number of commits after which branches are considered stale. GitHub 30

For the convenience, these variables can be set in a .env file in the project directory and use the direnv ( mentioned above) to load them automatically for every project separately.

Veles will read Terragrunt configuration and expand any dynamic config available statically. For example for each selected Terragrunt module backed configuration will be read to determine exact values of the S3 bucket and DynamoDB table and key used for locking the state.

License

This project is licensed under the MIT License.

Velez

Name of the project is a misspelled name of the slavic god of the underworld - Veles.

About

DevOps/CloudOps CLI framework for making work with Terragrunt and performing various cloud operations much easier.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages