Skip to content

🐍 - Wizard tool for create folders and terraform files automated, written in Python !

License

Notifications You must be signed in to change notification settings

miltlima/terramagic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c4fb6f7 Β· Sep 4, 2023
Aug 18, 2023
Oct 31, 2021
Mar 5, 2023
Nov 5, 2021
Nov 7, 2021
Oct 31, 2021
Sep 4, 2023
Mar 8, 2023
Sep 4, 2023
Feb 27, 2023
Sep 4, 2023

Repository files navigation

"Buy Me A Coffee"

Terramagic CLI

Terramagic is a command-line interface tool that makes it easy to create and manage Terraform projects.

Motivation

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.

Requirements

Python 3.9 or higher

Installation

You can easily install Terramagic using pip:

pip3 install terramagic

Usage

Creating a new project

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
└── variables.tf

You can then edit these files to define your infrastructure resources and variables.

Deleting a project

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 myapp

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!