DevOps/CloudOps CLI framework for making work with Terragrunt and performing various cloud operations much easier.
- Supporting following services/tools and operations on them:
- Terragrunt:
- Walk directory structure containing Terragrunt modules.
- Run Plan on a selected module or a specific target.
- Run Apply on a selected module or a specific target.
- Import a resource to the state.
- Run Destroy on a selected module or a specific target.
- Run Output on a selected module or a specific target.
- Run Validate on a selected module.
- Run Refresh on a selected module.
- Run State operations like:
- List resources.
- Move a resource.
- Remove a resource.
- Show resource.
- Pull and push state.
- 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.
- Taint and Untaint a resource.
- Unlock module and show lock information.
- File operations:
- Formatting all HCL files in the project.
- Cleaning up temporary files in the project or a selected module.
- Terragrunt:
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
hcledit- required for updating.hclfiles. - Install
direnvif not installed yet - highly suggested for managing environments.
It can be installed, e.g. by running:
brew install python 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 --helpTo use the Velez CLI, you have two options:
Run the CLI without additional arguments to use the interactive menu:
velezRun 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-accountVelez expects following environment variables to be set if corresponding values are not hardcoded in the root Terragrunt configuration file:
VELEZ_ROOT_HCL- relative path to the Terragrunt configuration file, e.g.root.hcl.VELEZ_TEMP_CONFIG- absolute path to a temporary file created to render Terragrunt configuration, e.g./tmp/terragrunt.hcl.
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.
