Skip to content

Instantly share code, notes, and snippets.

@Farhie
Farhie / pre-commit
Created January 18, 2018 19:35 — forked from jamtur01/pre-commit
A Terraform validation and formatting pre-commit hook
#!/usr/bin/env bash
set -e
# Formats any *.tf files according to the hashicorp convention
files=$(git diff --cached --name-only)
for f in $files
do
if [ -e "$f" ] && [[ $f == *.tf ]]; then
#terraform validate `dirname $f`
terraform fmt $f

Keybase proof

I hereby claim:

  • I am farhie on github.
  • I am farhie (https://keybase.io/farhie) on keybase.
  • I have a public key ASBbGd1duhPNbjajgaY84x85CxNBqLhNvgFAwJWvnx9yPwo

To claim this, I am signing this object:

@Farhie
Farhie / samlauth.py
Last active September 26, 2017 04:15
Script to authenticate using NLTM and then generate AWS creds using boto assume role. Heavily inspired by https://aws.amazon.com/blogs/security/how-to-implement-federated-api-and-cli-access-using-saml-2-0-and-ad-fs/ with some extensions and significant refactoring.
#!/usr/bin/env python
import ConfigParser
import argparse
import base64
import getpass
import xml.etree.cElementTree as elementTree
from collections import namedtuple
from os.path import expanduser
import boto.sts