Coder Social home page Coder Social logo

yukihiko-shinoda / docker-compose-terraform Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 17 KB

The develop environment for Terraform projects.

License: MIT License

Dockerfile 33.86% Python 61.34% Shell 4.80%
terraform docker docker-compose visual-studio-code python automation development-environment

docker-compose-terraform's Introduction

Docker Compose Terraform

The develop environment for Terraform projects.

Advantage

Out of the box📦 for any Terraform project:

  • Supports any Terraform version🙆 by tfenv
  • Auto format on save by HashiCorp Terraform Extension
  • Implements efficient commands🚀 for:
    • Format and test code quickly
      • terraform fmt -recursive
      • terraform validate
      • TFLint (if .tflint.hcl exists in Terraform project)
    • Plan all environment (supports running as parallel)
    • Render differences report of all plans
  • Customizable by jinja in YAML configuration file🔧
    • The directory to run terraform command
    • The command to select environment and prepare to plan.
    • The command to plan

Out of the box for any Terraform project

Quickstart

Requirement

Setup

1. Clone or download this project

git clone https://github.com/yukihiko-shinoda/docker-compose-terraform.git

2. Clone or download your Terraform project into root directory of this project

cd docker-compose-terraform
git clone <repository of your Terraform project>

3. Open Visual Studio Code on root directory

code .

4. Reopen in Container

Run the Remote-Containers: Reopen in Container command from the Command Palette (F1) or quick actions Status bar item.

5. Create config.yml to customize for your Terraform project

Copy config.yml.dist to config.yml, then edit it.

Details is explained by comments in its file.

6. Create report.md.jinja to render report of plans

Copy report.md.jinja.dist to report.md.jinja, then edit it.

The differences of all plan is rendered at point of corresponding environment name which is defined into config.yml.

EX:

projects:
  terraform-project-a:
# ------------------------------
    environments:
      dev: {}
      prod: {}
## dev

```console
{{ dev }}
```

## prod

```console
{{ prod }}
```

Usage

Format and test code quickly

fmt-test <project directory name>

EX:

fmt-test terraform-project-a

Plan all environment

Note: If you are using Terraform Enterprise, it requires to login to Terraform Enterprise before run following commands.

pytest tests --prj <project name defined in YAML>

EX:

pytest tests --prj terraform-project-a

As parallel

pytest tests --prj <project name defined in YAML> -n <number of processes>

EX:

pytest tests --prj terraform-project-a -n 3

Render report differences of all plans

python report.py

Then, report will be render to ./report.md .

docker-compose-terraform's People

Contributors

yukihiko-shinoda avatar

Stargazers

Niranjan Anandkumar avatar Naoki_Egawa avatar

Watchers

 avatar

docker-compose-terraform's Issues

Migrate from tfenv to tenv

Hi! I saw that you're using tfenv in this repository. It's a really good tool, but it does not support OpenTofu and Terragrunt. My team designed a successor of tenv that support Terraform, Terragrunt and OpenTofu. It will be a good idea to migrate into it in due to the growing popularity of OpenTofu.
url: https://github.com/tofuutils/tenv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.