terraform-cascade

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

README

Terraform Cascade

Demo

asciicast

Overview

Terraform Cascade is a terraform-like tool that allows you to manage multiple terraform projects.

It's made to be fully compatible with terraform, so you can use it as a drop-in replacement. However, it requires the terraform binary to be available in the PATH.

Design

It works with a very opinionated design:

  • Every project is inside a deep directory structure.
  • To define a project, you only need to place a backend.tf file in that directory.
  • In each layer, will be executed in the following order:
    1. Current directory (only when it has a backend.tf file)
    2. Whole base directory (with its layer)
    3. Other directories (with its layer)

Usage

Build
docker build -t cascade .
Run example
cd samples/basic/ # Some sample project that has dependencies between layers
# Full dependency tree in order
docker run -it --rm -v $(pwd):/w -v $(pwd)/tmp:/tmp -w /w cascade init --cascade-recursive
docker run -it --rm -v $(pwd):/w -v $(pwd)/tmp:/tmp -w /w cascade apply --cascade-recursive --auto-approve
# Full dependency tree in parallel
docker run -it --rm -v $(pwd):/w -v $(pwd)/tmp:/tmp -w /w/dev cascade apply --cascade-recursive --auto-approve
Generated infra
$ tree -a -I .terraform tmp/cascade
tmp/cascade
├── dev
│   ├── .account
│   ├── s3
│   │   └── .s3
│   └── vpc
│       ├── .vpc
│       └── eks
│           └── .eks
├── ops
│   ├── .account
│   └── vpc
│       └── .vpc
└── prod
    ├── .account
    └── vpc
        ├── .vpc
        └── eks
            └── .eks
Generated terraform states
$ tree -a tmp/cascade/.terraform/
tmp/cascade/.terraform/
├── base.tfstate
├── dev_base.tfstate
├── dev_eks.tfstate
├── ops_base.tfstate
├── prod_base.tfstate
└── prod_eks.tfstate

Documentation

Overview

Copyright © 2023 Álvaro Torres Cogollo <atorrescogollo@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL