Skip to content

Instantly share code, notes, and snippets.

View ericreeves's full-sized avatar

Eric Reeves ericreeves

  • HashiCorp
  • Houston, TX
  • 23:28 (UTC -05:00)
  • X @ericreeves
View GitHub Profile
packer {
required_plugins {
amazon = {
version = ">= 1.0.1"
source = "github.com/hashicorp/amazon"
}
}
}
data "amazon-ami" "ubuntu-server-east" {
@ericreeves
ericreeves / archivist_renamer.py
Created January 23, 2024 00:26
Script to Rename TubeArchivist Downloads Using the TubeArchivist API
import os
import requests
import sys
from datetime import datetime
# Configurable variables
archivist_api_token = os.getenv('ARCHIVIST_API_TOKEN')
archivist_host = os.getenv('ARCHIVIST_HOST')
# Function to sanitize file name
@ericreeves
ericreeves / namespace-bound-service-account-audit.sh
Last active January 2, 2024 22:02
Audit HashiCorp Vault for Unique Bound Service Account Names in Each Namespace
#!/bin/bash
# Ensure VAULT_ADDR and VAULT_TOKEN are exported.
# Ensure VAULT_NAMESPACE is unset
# Function to list namespaces recursively
function list_namespaces {
entry_point=$(echo ${1} | sed 's/\/$//')
echo "${entry_point}/"
## first, check if root ns, and if so collect children slightly differently due to path specification
@ericreeves
ericreeves / tfe_list_all_workspaces.sh
Last active August 21, 2023 20:43
Terraform Enterprise/Cloud - List All Workspaces
#!/bin/bash
#
# Terraform Enterprise/Cloud - List All Workspaces in All Organizations
#
#------------------------------------------
# DESCRIPTION
#------------------------------------------
# This script will list all workspaces in all organizations visible to the user for which the TFE_TOKEN was generated
#
#------------------------------------------
@ericreeves
ericreeves / vault_recursive_namespace_list.sh
Created May 17, 2023 00:50
Bash Script to List Vault Namespaces Recursively
#!/bin/bash
# First passing argument is the depth
# The second passing argument is the starting namespace
# Example usage to list namespaces 10 levels deep from the "root" namespace:
# ./vault_recursive_namespace_list.sh 10
# Example usage to list namespaces 5 levels deep from the "customer1" namespace.
# ./vault_recursive_namespace_list.sh 5 customer1
@ericreeves
ericreeves / denied-resources.sentinel
Created May 11, 2023 18:33
Sentinel Policy to Deny Deployment of Specific Resource Types
# This policy uses the tfconfig/v2 import to deny resources
# from an denied list
# Import common-functions/tfconfig-functions/tfconfig-functions.sentinel
# with alias "config"
import "tfconfig-functions" as config
# List of denied resources
denied_list = ["aws_instance", "azurerm_virtualmachine", "google_compute_instance"]
@ericreeves
ericreeves / tfx-remote-state-sharing.sh
Last active May 11, 2023 18:22
Quick Bash Script Wrapper for TFX to List All Remote Source Sharing for All Workspaces in an Organization
#!/bin/bash
#
# Quick and dirty script that wraps around the TFX CLI tool to list all Workspaces within an Orgainzation, and then list all remote state
# sharing for each Workspace.
#
# Acquire tfx here: https://tfx.rocks/
# TFX can be configured using environment variables TFE_HOSTNAME, TFE_ORGANIZATION, TFE_TOKEN
#
export TFE_HOSTNAME="app.terraform.io"
#export VAULT_TOKEN="<root>"
export NS="TEST-NAMESPACE"
echo "--- Creating namespace"
vault namespace create $NS
echo "--- Enable approle auth within namespace"
vault auth enable -namespace=$NS approle
# create policy
echo "--- Writing ns-admin policy"
echo '# Read TEST-NAMESPACE Namespace
@ericreeves
ericreeves / active_border.ahk
Last active April 26, 2024 02:58
AHK Script for Active Window Border in Windows 11 22H2
;
; Inspiration / Code Jacked from the following resources:
; https://www.reddit.com/r/windowsporn/comments/x6299x/a_small_effect_on_window_switching/
; https://superuser.com/questions/1190658/fine-tune-this-red-border-around-active-window-ahk-script/1191059#1191059?newreg=d3acdcdab8714e76a5efeca9996e792f
; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=110505
; https://discord.com/channels/898554690126630914/898556726108901386/1053662963585781760 # Komorebi Discord
;
#NoEnv
#SingleInstance, Force
@ericreeves
ericreeves / monitoring.conf
Last active November 15, 2022 01:07
tmux Monitoring Panes Example
send-keys 'echo Top Left' C-m
split-window -h
send-keys 'echo Top Right' C-m
select-pane -t 0
split-window -v
send-keys 'echo Bottom Left' C-m
select-pane -t 2
split-window -v
send-keys 'echo Bottom Right' C-m