Skip to content

Instantly share code, notes, and snippets.

View ksatirli's full-sized avatar

Kerim Satirli ksatirli

View GitHub Profile
@ksatirli
ksatirli / README.md
Created November 11, 2021 10:00
Get Terraform Cloud Output Values

Get Terraform Cloud Output Values

This code is based around a question posted on Twitter

Usage

  • Log into Terraform Cloud using terraform login.
  • Apply the three outputs in main.tf using terraform apply.
  • Execute get-terraform-cloud-output-values.sh to retrieve the output values through the TFC API.
@ksatirli
ksatirli / rename-terraform-cloud-organization.sh
Created September 3, 2020 14:20
rename Terraform Cloud Organization
#!/bin/sh
# This script sends a requests to the Terraform Cloud API and updates the
# organization name from "${OLD_TFC_ORG_NAME}" to "${NEW_TFC_ORG_NAME}".
#
# This script can be useful when you need to rename a TFC Organization without
# wanting to (or being able to) start from scratch.
#
# Use this script with care, as this request is carried out against the API, only.
# Check your (local) Terraform Resources for references to `OLD_TFC_ORG_NAME` and
@ksatirli
ksatirli / terraform-cloud-ip-ranges.tf
Created August 10, 2020 16:43
Terraform Cloud IP Ranges as Terraform Variables
terraform {
required_providers {
http = "~> 1.2"
}
required_version = "~> 0.12.29"
}
data "http" "terraform_cloud_ip_ranges" {
url = "https://app.terraform.io/api/meta/ip-ranges"
@ksatirli
ksatirli / install-all-shipyard-versions.sh
Created July 17, 2020 07:52
Install all Shipyard versions
#!/usr/bin/env bash
VERSIONS=(0.0.37 0.0.36 0.0.35 0.0.33 0.0.32 0.0.31 0.0.30 0.0.29 0.0.28 0.0.27 0.0.26 0.0.25 0.0.24 0.0.23 0.0.22 0.0.21 0.0.20 0.0.19 0.0.18 0.0.17 0.0.16 0.0.15 0.0.14 0.0.13 0.0.12 0.0.11 0.0.10 0.0.9 0.0.8 0.0.7)
SHIPYARD="/Users/ksatirli/Downloads/yard-darwin"
for VERSION in "${VERSIONS[@]}"
do
${SHIPYARD} version install "${VERSION}"
done
@ksatirli
ksatirli / _managing-github-with-terraform.md
Created January 31, 2020 13:17
Presentation Notes: Managing GitHub with Terraform
@ksatirli
ksatirli / README.md
Created November 10, 2017 10:20
generate signed URL for AWS S3

generate a signed URL for AWS S3 Bucket Objects by calling this script the following way:

python s3-generate-signed-url.py "us-west-1" "my-bucket" "index.html"

The output will look something like this:

@ksatirli
ksatirli / get-azure-vm-plan-details.sh
Created October 26, 2017 14:55
get Azure RM Virtual Machine Plan Details
# login to Azure CLI
az login
# complete flow by opening aka.ms/devicelogin and entering code
# list Azure VMs, pipe to `jq`, then get `plan` details of 0th instance
az vm list | jq .[0].plan
@ksatirli
ksatirli / docker-cleanup-volumes.sh
Created September 18, 2017 10:59
Docker: clean up (dangling) volumes
#!/bin/sh
docker volume ls -qf dangling=true | xargs -r docker volume rm
@ksatirli
ksatirli / alternate-bitbucket-pipelines.yml
Last active August 11, 2019 12:29
Bitbucket: push assets to AWS CloudFront
---
pipelines:
cloudfront:
- step:
image: python:3.5.1
script:
- pip install awscli
# set up AWS access credentials incl. region
- export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"
@ksatirli
ksatirli / .docker-config.json
Last active September 9, 2017 16:07
Nexus: using local registries for common services
{
"auths": {
"https://index.docker.io/v1/": {},
"localhost:8083": {}
},
"credsStore": "osxkeychain"
}