Render Terraform's Expressions and Functions locally without any hassle.
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.
Windows
Chocolatey Windows Package Manager
IMPORTANT: Open a PowerShell terminal as Administrator
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
choco install -y make
macOS:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install make
git clone https://github.com/unfor19/tfcoding.git
tfcoding
cd tfcoding
make run
tfcoding
container
make clean
This project uses localstack, which means you can provision the AWS core resources, see examples/mock-aws/.
git clone https://github.com/unfor19/tfcoding.git
tfcoding
cd tfcoding
make up-aws
Execute terraform destroy
on changing tfcoding.tf
, add the Local Value terraform_destroy = true
. For example:
// After "destroying" the infra, comment out this variable to execute `terraform apply`
locals {
terraform_destroy = true
}
Clean resources - Removes tfcoding
and localstack
containers
make clean-all
make help
With Docker:
docker run --rm -it unfor19/tfcoding --help
Usage: bash entrypoint.sh -r basic/exmaples --watching -o private_subnets
--src_dir_relative_path | -r [REQUIRED] Relative path to the dir that contains tfcoding.tf
--single_value_output | -o [all] Render a single local variable
--src_dir_root | -s [/src] Source root dir in container
--logging | -l [true] Show logging messages
--debug | -d [false] Print verbose output
--watching | -w [FLAG] Auto-render tfcoding.tf on change
--mock_aws | -aws [FLAG] Use this flag for communicating with Localstack
Created and maintained by Meir Gabay
This project is licensed under the MIT License - see the LICENSE file for details