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!
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.
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.
Framework is written in Python and can be installed as a package.
-
Clone the repository:
git clone https://github.com/devops-infra/velez.git
-
Navigate to the project directory:
cd velez
-
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
-
Install the package:
pip install .
Run the CLI with the --help
argument to see the available commands:
velez --help
To use the Velez CLI, you have three options:
Run the CLI without additional arguments to use the interactive menu:
velez
velez --terragrunt <operation> <module> <other-arguments>
Show menu for file operations:
velez --file
Show menu for GitHub operations:
velez --github
Run the CLI with additional arguments for automation/scripting:
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
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.
This project is licensed under the MIT License.
Name of the project is a misspelled name of the slavic god of the underworld - Veles.