Skip to content

Instantly share code, notes, and snippets.

@phinze
phinze / teams-to-workspaces.tf
Last active June 21, 2022 04:23
An example of how you could map teams to many workspaces using the Terraform Enterprise provider
# Start w/ a data source to get a list of all the workspaces
# See: https://www.terraform.io/docs/providers/tfe/d/workspace_ids.html
data "tfe_workspace_ids" "all-workspaces" {
names = ["*"]
organization = "my-org-name"
}
# Look up the ID of the teamn you're looking to map
# See: https://www.terraform.io/docs/providers/tfe/d/team.html
data "tfe_team" "architects" {
@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)]
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=RunInstances \
--query 'Events[0].CloudTrailEvent' | jq -r . | jq .
@hummus
hummus / gist:8592113
Last active April 26, 2024 19:45
aws cli + jq example
wget http://stedolan.github.io/jq/download/linux64/jq
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \
"Name=instance-state-name,Values=running" \
| jq -r \
".Reservations[] | .Instances[] | .InstanceId" \
aws ec2 describe-volumes --filters \
"Name=status,Values=available" \
| jq -r ".Volumes[] | .VolumeId" \