Skip to content

Instantly share code, notes, and snippets.

Tom Davidson tomdavidson

Block or report user

Report or block tomdavidson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tomdavidson
tomdavidson / tf-config-files.tf
Created Dec 5, 2019
Terraform example loading config from dir of files
View tf-config-files.tf
variable "config_files_path" {
default = "../../teams/*.yaml"
description = "The path to team config files"
}
data "local_file" "configs" {
for_each = { for k, file in fileset(dirname(var.config_files_path), basename(var.config_files_path)) :
k => abspath("${dirname(var.config_files_path)}/${file}")
}
View lolaus.sh
#!/usr/bin/env bash
help() {
cat <<EOF
Simple monorepo lifecycle/pipeline tool for running one or more commands on one
or more directories that have diffs compared to an ansector. The primary
use case is for selective CI jobs within a trunk based workflow.
Takes two arguments, <glob> <command>. The command is invoked from each
directory context matching the glob.
@tomdavidson
tomdavidson / ghteams.tf
Last active Sep 3, 2019
tf to create children teams after looking up parent ids
View ghteams.tf
## Existing list of teams with members list:
"0" = {
"description" = "No one cared enough to add a description to this team"
"members" = [
{
"role" = "maintainer"
"username" = "bob"
},
{
@tomdavidson
tomdavidson / main.tf
Created Sep 1, 2019
the find file sub mod
View main.tf
variable "filter" {
type = string
default = "*.yaml"
description = "The pattern used to filter files, i.e. '*.yaml'."
}
variable "search_dir" {
type = string
default = "."
description = "The the directory to search from. Default is '.'."
View gist:26a05aff8b31ee85338ae3b348732dd8
$ terraform plan
2019/09/01 02:45:19 [INFO] Terraform version: 0.12.7
2019/09/01 02:45:19 [INFO] Go runtime version: go1.12.9
2019/09/01 02:45:19 [INFO] CLI args: []string{"/home/tom/.asdf/installs/terraform/0.12.7/bin/terraform", "plan"}
2019/09/01 02:45:19 [DEBUG] Attempting to open CLI config file: /home/tom/.terraformrc
2019/09/01 02:45:19 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/09/01 02:45:19 [INFO] CLI command args: []string{"plan"}
2019/09/01 02:45:19 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/09/01 02:45:19 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/09/01 02:45:19 [DEBUG] New state was assigned lineage "156a7836-272f-0a26-f953-8f8fc4b37f8b"
@tomdavidson
tomdavidson / config.tf
Last active Feb 24, 2018
tectonic-installer#3025
View config.tf
/**
* Defaults and other config items for the K8S Installer
*
*/
terraform {
backend "s3" {}
required_version = ">= 0.10.7"
}
View allow-user-iam.json
{
"Version": "2012-10-17",
"Statement":[
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action":[
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountSummary"
@tomdavidson
tomdavidson / example-aws-assume-role-wrapper.sh
Created Jun 17, 2016
wrapper scirpt that assumes aws role
View example-aws-assume-role-wrapper.sh
#! /usr/bin/env bash
# Wrapper scirpt that assumes aws role and then runs your script that needs the creds.
# Im not remembering where I got it, but it was at least inspired by another if not verbarium.
account_id=$1
role=$2
CMD="$@"
ACCOUNT_ID=11111111111
You can’t perform that action at this time.