Terramagic is a command-line interface tool that makes it easy to create and manage Terraform projects.
Creating a new Terraform project from scratch can be time-consuming and error-prone. With Terramagic, you can quickly generate a template for your project and customize it to your needs.
Python 3.9 or higher
You can easily install Terramagic using pip:
pip3 install terramagic
To create a new Terraform project, use the create command:
terramagic create --name <project_name>
For example, to create a project called "infra" automatically 3 environments are created ("development", "staging" and "production") and respective tfvars, run:
terramagic create --name infra
This will generate a new directory called "infra" with the following structure:
infra
βββ backend.tf
βββ environments
β βββ development
β β βββ development.tfvars
β βββ production
β β βββ production.tfvars
β βββ staging
β βββ staging.tfvars
βββ main.tf
βββ main.tfvars
βββ modules
β βββ cluster
β β βββ main.tf
β β βββ outputs.tf
β β βββ variables.tf
β βββ instance
β β βββ main.tf
β β βββ outputs.tf
β β βββ variables.tf
β βββ vpc
β βββ main.tf
β βββ outputs.tf
β βββ variables.tf
βββ outputs.tf
βββ providers
β βββ provider.tf
βββ variables.tf
You can then edit these files to define your infrastructure resources and variables.
To delete an existing project, use the delete command and specify the project name:
terramagic delete --name <project_name>
For example, to delete the "myapp" project, run:
terramagic delete --name infra
Help For detailed information about available commands and options, run:
terramagic --help
This will display the following message:
Usage: terramagic [OPTIONS] COMMAND [ARGS]...
ClI tool to create Terraform project
Options:
-v, --version Show version
--help Show this message and exit.
Commands:
create Create a new Terraform project with specified name and environment
remove Delete the project
Enjoy using Terramagic to simplify your Terraform workflow!