Skip to content

Instantly share code, notes, and snippets.

@lorengordon
lorengordon / common_sso_permission_sets.tf
Last active June 16, 2023 23:30
More examples using plus3it/terraform-aws-tardigrade-sso-admin
# This configuration creates permission sets that will be assigned across many accounts. This
# would be managed centrally, and the provider for this config should be set to the management
# account for AWS Identity Center.
module "sso_admin" {
source = "git::https://github.com/plus3it/terraform-aws-tardigrade-sso-admin.git?ref=2.0.1"
sso_admin = {
permission_sets = local.permission_sets
}
@lorengordon
lorengordon / Microsoft.PowerShell_profile.ps1
Created January 29, 2018 18:34
Powershell profile with admin check
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "Skipping functions that require elevated permissions..."
}
else
{
# Do admin stuff
}
@lorengordon
lorengordon / tf-build-plugins.sh
Last active November 16, 2017 14:08
Build Cross-Platform Terraform Plugins
AWS_PROVIDER_REPO=https://github.com/terraform-providers/terraform-provider-aws.git
AWS_PROVIDER_BRANCH=master
# Pre-req: Have a working go install :-)
# Get go: https://golang.org/dl/
# Install go: https://golang.org/doc/install
#curl -LO https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz
#sudo tar -C /usr/local -xvzf go*.linux-amd64.tar.gz
sudo yum -y install git
@lorengordon
lorengordon / keybase.md
Created September 23, 2017 21:05
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@lorengordon
lorengordon / TfExternal.py
Created September 22, 2017 18:32
Python helper for a Terraform External provider
import json
class TfExternal(object):
"""Wrap Terraform External provider."""
@staticmethod
def query_args(obj):
"""Load json object from stdin."""
return {} if obj.isatty() else json.load(obj)
@lorengordon
lorengordon / salt-development-install.txt
Last active June 30, 2017 13:24
Install salt for development on EL6/7
sudo -i
REPO="https://github.com/<your-fork>/salt"
BRANCH="<your-branch>"
# EL6
#yum -y install centos-release-SCL
#yum -y install python27 python27-python-devel python27-python-setuptools python27-python-tools python27-python-virtualenv
#yum -y --enablerepo=epel install git gcc gcc-c++ swig openssl-devel python27-python-pip
#scl enable python27 bash
@lorengordon
lorengordon / Manage-R53RecordSet.ps1
Last active May 30, 2023 11:18
PowerShell Script to Create/Delete/Update AWS Route53 Record Set
[CmdLetBinding()]
Param(
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)]
[String] $HostedZoneId,
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)]
[ValidateSet("CNAME","A","AAAA","MX","TXT","PTR","SRV","SPF","NS","SOA")]
[String] $Type,
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)]
@lorengordon
lorengordon / .travis.yml
Last active August 26, 2016 10:51
Update __version__ for travis deployment to testpypi
before_deploy:
- python $TRAVIS_BUILD_DIR/ci/travis_set_build.py --file-paths '("<project>", "__init__.py")' --skip "$TRAVIS_TAG"
deploy:
- provider: pypi
server: https://testpypi.python.org/pypi
distributions: sdist
user: <username>
password:
secure: <encrypted_password>
skip_cleanup: true
@lorengordon
lorengordon / tmpfsroot-el6.sh
Created June 20, 2016 13:36
Create AWS AMIs from Scratch
#!/bin/bash
#
# Pivot the root partition to a tmpfs mount point so that the root volume can
# be re-partitioned.
#
##############################################################################
set -x
set -e
# Prevent selinux from interfering
@lorengordon
lorengordon / packer-download-file.json
Last active April 26, 2016 11:58
packer-download-file-create-directory
{
"builders": [
{
"type": "amazon-ebs",
"ami_name": "packer-download-file",
"communicator": "ssh",
"instance_type": "t2.micro",
"region": "us-east-1",
"source_ami": "ami-1c221e76",
"ssh_username": "centos",