Skip to content

Instantly share code, notes, and snippets.

@ppar
ppar / terraform_separate_environments.md
Last active April 21, 2023 12:31
How to use a single Terraform repo with multiple independent environments

Summary

This text demonstrates a pattern for using a single repository of Terraform code to manage multiple, completely independent environments that contain the same infrastructure.

It's based on simply overriding the terraform data and config files on each execution with:

  • $TF_DATA_DIR
#!/bin/bash
# mygrants.sh
#
# This script dumps all grants for all users in MySQL as an SQL script that you can pipe back to mysql
#
# USAGE: ./mygrants.sh [command line options to mysql, e.g. login]
#
mysql -B -N $@ \
@ppar
ppar / install-boa-constructor-macos.sh
Created March 2, 2018 03:14
Boa Constructor install script (/ instructions) for macOS
#!/usr/bin/env bash
######################################################################
# Boa Constructor installation script for OS X / macOS
#
# This script tries to automate the installation of Boa Constructor
# https://bitbucket.org/cwt/boa-constructor on macOS.
#
# Tested on macOS Sierra / 10.12.6 / Darwin 16.7.0
#
# Requirements:
@ppar
ppar / http_sink.py
Last active April 28, 2017 00:39
Simple HTTP Sink server for Python 2, dumps all GET/HEAD/POST/PUT requests to stdout
#!/usr/bin/env python
# Simple HTTP Sink server for Python 2
# Dumps all received GET/HEAD/POST/PUT requests to stdout, returns configurable HTTP response code
# Usage:
# python http_sink.py [listen_port] [http_result_code]
# Based on https://gist.github.com/bradmontgomery/2219997
from __future__ import print_function
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class S(BaseHTTPRequestHandler):