Skip to content

Instantly share code, notes, and snippets.

@jmahowald
jmahowald / README.md
Created May 21, 2021 14:12
using terraform to wire GCP workload identity federation

Authenticating for bootstrap

gcloud auth application-default login A web browser should open up, asking you to authorize access .

You can set up a default tfvars for the input. For instance


project_id = "internal-lab"
aws_identity_pool_info = {

Keybase proof

I hereby claim:

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jmahowald on github.
  • I am joshmahowald (https://keybase.io/joshmahowald) on keybase.
  • I have a public key ASBsoqiKIMXMYFlTws6a0uNQm82SpU6eJZoJ_UXbo6qMago

To claim this, I am signing this object:

@jmahowald
jmahowald / travisset.sh
Created October 4, 2017 05:25
Scriptlet to allow one to easily set secure environment variables for all travis repos. H/T https://github.com/travis-ci/travis-ci/issues/2069#issuecomment-300425169
#!/bin/bash
PATTERN=$1
ENV_VAR=$2
travis repos --pro --no-interactive -m $1 | xargs -n1 travis env set $ENV_VAR ${!ENV_VAR} --private --repo
@jmahowald
jmahowald / gist:1431cc274ad982ad005c0ae9c0f626cb
Created September 11, 2017 17:49
terragruntplanalltestingoutput
test(improverrorforplanall) $ go test -timeout 30s -run ^TestTerragruntReportsTerraformErrorsWithPlanAll
[terragrunt] [/var/folders/t5/qp9yz47s44z96jm16jv9m78m0000gq/T/terragrunt-stack-test191196644/fixture-failure] 2017/09/11 11:59:56 Running command: terraform --version
[terragrunt] 2017/09/11 11:59:56 Stack at /var/folders/t5/qp9yz47s44z96jm16jv9m78m0000gq/T/terragrunt-stack-test191196644/fixture-failure:
=> Module /var/folders/t5/qp9yz47s44z96jm16jv9m78m0000gq/T/terragrunt-stack-test191196644/fixture-failure (dependencies: [])
=> Module /var/folders/t5/qp9yz47s44z96jm16jv9m78m0000gq/T/terragrunt-stack-test191196644/fixture-failure/missingvars (dependencies: [])
[terragrunt] [/var/folders/t5/qp9yz47s44z96jm16jv9m78m0000gq/T/terragrunt-stack-test191196644/fixture-failure/missingvars] 2017/09/11 11:59:56 Module /var/folders/t5/qp9yz47s44z96jm16jv9m78m0000gq/T/terragrunt-stack-test191196644/fixture-failure/missingvars must wait for 0 dependencies to finish
[terragrunt] [/var/folders/t5/qp9yz47s44z96jm16jv
@jmahowald
jmahowald / gist:b5d96d53a1a40a3ebd72
Created March 26, 2015 22:35
thor actions to help with kitchen reloads
require 'thor'
require 'fileutils'
require 'yaml'
##
# common commands used to manage berks in a way that makes sense for that
# Inspired by the fact that berks is a great idea that is painfully slow
# when using mercurial, and thus needs to work around the prescribed workflow
@jmahowald
jmahowald / after VM is up
Created March 20, 2015 19:36
Issues with windows guest support
bundle exec kitchen converge -l debug devops-wfm
-----> Starting Kitchen (v1.3.2.dev)
D [Vagrant command] BEGIN (vagrant --version)
D [Vagrant command] END (0m0.43s)
D Berksfile found at /Users/josh/workspace/projects/chefgen/localization/Berksfile, loading Berkshelf
D Berkshelf 3.2.3 library loaded
D Berksfile found at /Users/josh/workspace/projects/chefgen/localization/Berksfile, loading Berkshelf
D Berkshelf 3.2.3 previously loaded
-----> Creating <devops-wfm>...
D <devops-wfm> is synchronizing on Kitchen::Driver::Vagrant#create
@jmahowald
jmahowald / chefdk_bootstrap.sh
Created August 13, 2014 03:47
Bootstrap chef script for centos to use chef dk instead of chef omnibus
sudo yum install wget -y
export RPM_VERSION=chefdk-0.2.0-2.el6.x86_64
export CHEF_RPM=$RPM_VERSION.rpm
if rpm -qa|grep $RPM_VERSION; then
echo "Already have chef dk installed"
else
wget --no-check-certificate https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/$CHEF_RPM
sudo rpm -iU $CHEF_RPM
chef -v
@jmahowald
jmahowald / gist:7654558
Created November 26, 2013 07:21
Chef shell script in vagrant to debug chef-solo-search problems
Chef::Config[:cookbook_path] = "/tmp/vagrant-chef-1/chef-solo-1/cookbooks/"
run_list = "recipe[chef-solo-search]"
cl = Chef::CookbookLoader.new(Chef::Config[:cookbook_path])
cl.load_cookbooks
cookbook_collection = Chef::CookbookCollection.new(cl)
@events = Chef::EventDispatch::Dispatcher.new()
node.run_context = Chef::RunContext.new(node, cookbook_collection, @events)
node.run_list = Chef::RunList.new(run_list)
node.run_context.load(node.expand!)
@jmahowald
jmahowald / rvmbootsrap
Created May 6, 2011 15:42
Bootrsap of RVM
cat <<'BOOTSTRAP_AS_USER' > /home/$app_user/bootstrap_as_user.sh
set -e
bash < <( curl --insecure https://rvm.beginrescueend.com/install/rvm )
rvm_include_string='[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'
grep "$rvm_include_string" ~/.bashrc || echo "$rvm_include_string" >> ~/.bashrc
cat <<'RVMRC_CONTENTS' > ~/.rvmrc