Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Something something Quantum Kubernetes

Chance Zibolski chancez

💭
Something something Quantum Kubernetes
View GitHub Profile
View tf-import-route53-hosted-zone-records.py
import json
from os import getenv, path
from string import Template
from subprocess import run
from sys import exit
ZONE_ID = getenv("ZONE_ID")
ZONE_FILE = getenv("ZONE_FILE")
TERRAFORM_DIR = getenv("TERRAFORM_DIR")
View aws-generate-sso-profiles-functions.sh
function aws-sso-access-token() {
find "$HOME/.aws/sso/cache" -type f ! -name 'botocore*' -exec jq -r '.accessToken' {} \; | head -n1
}
function aws-sso-list-accounts() {
aws sso list-accounts --access-token "$(aws-sso-access-token)" "$@"
}
function aws-sso-list-account-roles() {
aws sso list-account-roles --access-token "$(aws-sso-access-token)" "$@"
View eval-object-to-env-jq.sh
eval "$(echo "$line" | jq -r 'to_entries | map("\(.key)=\(.value|tostring | @sh)") | join(" ")')"
View permission-sets-export.sh
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: $0 sso-instance-arn"
exit 1
fi
# set -e
# set -o pipefail
View supermicro_ipmi.py
#!/usr/bin/env python
import string
import sys
import hmac
import hashlib
def split_hex(value):
value = value[4:] if len(value) % 4 == 0 else "0" + value[4:]
return " ".join(value[i:i+4] for i in range(0, len(value), 4))
SECRET = bytearray.fromhex('85 44 E3 B4 7E CA 58 F9 58 30 43 F8')
D = hmac.new(SECRET, digestmod=hashlib.sha1)
View example-usage.tf
module "combined_acm_certificate" {
source = "../../modules/acm_certificate_dns_validated_multi_zone"
providers = {
aws.certificate_requester = aws.infra-production-account
aws.route53_cert_validator = aws.main-account
}
domain_name = "infra.example.com"
zone_to_san = {
"infra.example.com" = [
View main.tf
provider "aws" {
alias = "certificate_requester"
}
provider "aws" {
alias = "route53_cert_validator"
}
resource "aws_acm_certificate" "cert" {
provider = aws.certificate_requester
@chancez
chancez / loki-chunks.json
Created May 21, 2020
Loki dashboards that work with monolithic mode or microservices mode
View loki-chunks.json
{
"annotations": {
"list": [ ]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"links": [ ],
"refresh": "10s",
@chancez
chancez / example.tf
Last active Feb 19, 2021
Support creating a DNS validated ACM certificate containing SANs for multiple different hosted zones
View example.tf
module "combined_acm_certificate" {
source = "../../modules/acm_certificate_dns_validated_multi_zone"
domain_name = "infra.example.com"
zone_to_san = {
"infra.example.com" = [
"*.infra.example.com",
"*.dev.infra.example.com",
"*.staging.infra.example.com",
"*.production.infra.example.com",
View helm-template.sh
#!/bin/bash
set -e
DIR="$( cd "$(dirname "$0")" ; pwd -P )"
HELM_BIN=${HELM_BIN:-"helm"}
FAQ_BIN=${FAQ_BIN:-"faq"}
FETCH_GIT_REPO="${FETCH_GIT_REPO:-false}"