Skip to content

Instantly share code, notes, and snippets.

View osterman's full-sized avatar
🤙
https://slack.cloudposse.com

Erik Osterman (CEO @ Cloud Posse) osterman

🤙
https://slack.cloudposse.com
View GitHub Profile
@osterman
osterman / 1password-env.sh
Last active July 7, 2020 19:01
Export 1Password Secrets as Environment Variables
# Download `op` (one password cli) here https://app-updates.agilebits.com/product_history/CLI
# Secret to fetch by name from 1password
SECRET=${SECRET:-${1:-"Example Developer Secrets"}}
# Your 1Password organization
ORG=${ORG:-${2:-cloudposse}}
EMAIL=${EMAIL:-${3:-erik@cloudposse.com}}
@osterman
osterman / codefresh-validate-step
Created May 2, 2020 16:36
Codefresh Validation Step
validate:
title: "Validate"
description: "Ensure build parameters are present"
stage: Prepare
image: cloudposse/geodesic:0.116.0
entry_point: /etc/codefresh/require_vars
cmd:
- |-
${{GITHUB_REPO_STATUS_TOKEN}} Personal Access Token used to give scripts
permission to update the "status check" status on GitHub pull requests
@osterman
osterman / gist:36bf0fa96a04eef9864306e98bde5df9
Created January 18, 2019 07:41
terraform-force-unlock.sh
terraform force-unlock -force $(terraform console < /dev/null 2>&1 |grep ID:|cut -d: -f2)
@osterman
osterman / tfenv.md
Last active January 14, 2019 19:56
Using Terraform without Wrappers

One of the biggest pains with terraform is that it's not totally 12-factor compliant (III. Config). That is, terraform doesn't consume environment variables for all settings & parameters. As a result, many of us use wrappers like terragrunt to invoke terraform.

Have you ever wanted to set the backend config using strictly environment variables?

Well, as it turns out this is possible - just in an extremely roundabout way. For example, if we want to set the backend-config bucket using an environment variable, we can do the following:

export TF_CLI_ARGS_init="-backend-config=bucket=my-bucket"
#!/usr/bin/env bash
if [ "$1" != "" ]; then
name="$1"
fi
if [ "$name" == "" ]; then
name=$(basename $(pwd))
cd ../../
ehco running chamber-apply in $(pwd) 1>&2
@osterman
osterman / server.js
Created November 14, 2018 22:14
Docker Registry Authentication Proxy
var http = require('http'),
https = require('https'),
buffer = require('buffer'),
httpProxy = require('http-proxy');
var tokens = {},
basicAuth = new Buffer(process.env.BASIC_AUTH).toString('base64');
//

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

ssh-reagent () {
for agent in /tmp/ssh-*/agent.*; do
export SSH_AUTH_SOCK=$agent
if ssh-add -l 2>&1 > /dev/null; then
echo Found working SSH Agent:
ssh-add -l
return
fi
done
echo Cannot find ssh agent - maybe you should reconnect and forward it?
@osterman
osterman / install-python.sh
Last active March 9, 2021 15:58
Install Python on CoreOS
#!/bin/bash -uxe
VERSION=2.7.13.2713
PACKAGE=ActivePython-${VERSION}-linux-x86_64-glibc-2.3.6-401785
# make directory
mkdir -p /opt/bin
cd /opt
wget http://downloads.activestate.com/ActivePython/releases/${VERSION}/${PACKAGE}.tar.gz