项目作者: unfor19

项目描述 :
Render Terraform's Expressions and Functions locally without any hassle.
高级语言: Shell
项目地址: git://github.com/unfor19/tfcoding.git
创建时间: 2021-03-20T14:58:47Z
项目社区:https://github.com/unfor19/tfcoding

开源协议:MIT License

下载


tfcoding

Push latest version to DockerHub Dockerhub pulls

tfcoding

Render Terraform’s Expressions and Functions locally without any hassle.

This application runs in the background and watches for changes in the file tfcoding.tf, once this file is modified its Local Values are automatically rendered to the terminal’s output (stdout).

This is especially useful for learning about Expressions and Functions that you are not familiar with, while avoiding the whole shebang of terraform init, plan and apply. The goal here is to “compile Terraform” locally to speed up the development (and learning) process.

Requirements

  • Docker
  • (Optional) Docker Compose
  • Windows

    • Windows Git Bash
    • Chocolatey Windows Package Manager

      IMPORTANT: Open a PowerShell terminal as Administrator

      1. Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
    • Install requirements

      IMPORTANT: Open a PowerShell terminal as Administrator

      1. choco install -y make
  • macOS:

    • Homebrew macOS Package Manager
      1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    • Install requirements
      1. brew install make

Quick Start

  1. Clone this repo
    1. git clone https://github.com/unfor19/tfcoding.git
  2. From now on your working direcotry should be tfcoding
    1. cd tfcoding
  3. Render examples/basic/tfcoding.tf - Make changes in that file, like checking new Terraform Expressions
    1. make run
  4. Clean resources - Removes tfcoding container
    1. make clean

Getting Started

This project uses localstack, which means you can provision the AWS core resources, see examples/mock-aws/.

  1. Clone this repo
    1. git clone https://github.com/unfor19/tfcoding.git
  2. From now on your working direcotry should be tfcoding
    1. cd tfcoding
  3. Render examples/mock-aws/tfcoding.tf - Make changes in that file, like changing the CIDR of subnets
    1. make up-aws
  4. Execute terraform destroy on changing tfcoding.tf, add the Local Value terraform_destroy = true. For example:

    1. // After "destroying" the infra, comment out this variable to execute `terraform apply`
    2. locals {
    3. terraform_destroy = true
    4. }
  5. Clean resources - Removes tfcoding and localstack containers

    1. make clean-all

Help Menu

  1. make help

With Docker:

  1. docker run --rm -it unfor19/tfcoding --help
  1. Usage: bash entrypoint.sh -r basic/exmaples --watching -o private_subnets
  2. --src_dir_relative_path | -r [REQUIRED] Relative path to the dir that contains tfcoding.tf
  3. --single_value_output | -o [all] Render a single local variable
  4. --src_dir_root | -s [/src] Source root dir in container
  5. --logging | -l [true] Show logging messages
  6. --debug | -d [false] Print verbose output
  7. --watching | -w [FLAG] Auto-render tfcoding.tf on change
  8. --mock_aws | -aws [FLAG] Use this flag for communicating with Localstack

Authors

Created and maintained by Meir Gabay

License

This project is licensed under the MIT License - see the LICENSE file for details