Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import boto3
import getopt
import sys
import subprocess
import time
def main(argv):
helptext = 'refresh.py -f <path to terraform project> -asg1 <asg1> -asg2 <asg2> -e <environment.tfvars path>'

Keybase proof

I hereby claim:

  • I am mattiasgees on github.
  • I am mattiasg (https://keybase.io/mattiasg) on keybase.
  • I have a public key ASDO34-SBhF4FuM99-eIYwIREpnvCdinueOdl-kTN74lAgo

To claim this, I am signing this object:

output "vpc_id" {
value = "${module.vpc.vpc_id}"
}
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.aws_region}"
}
resource "terraform_remote_state" "remote_state" {
backend = "s3"
config {
bucket = "mybucketname"
Outputs:
proxy_subnets = subnet-1232ae34,subnet-abc41234,subnet-abc1e399
vpc_id = vpc-1232ae34
output "vpc_id" {
value = "${aws_vpc.main.id}"
}
output "proxy_subnets" {
value = "${join(",", aws_subnet.proxy_subnets.*.id)}"
}
terraform remote config -backend=s3 -backend-config="bucket=mybucketname" -backend-config="key=nam_of_key_file"
# Configure with AWS CLI
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: eu-west-1
Default output format [None]: json
# Export as environment variable
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=eu-west-1
@MattiasGees
MattiasGees / gist:fba2950049c52c29ce37
Created January 5, 2015 16:51
Set replica to 0 for all indexes
IFS=$'\n'
for line in $(curl -s 'localhost:9200/_cat/indices?v'); do
INDEX=$(echo $line | (awk '{print $2}'))
REP=$(echo $line | (awk '{print $4}'))
if [ $REP != 0 ]
then
$(curl -XPUT http://localhost:9200/$INDEX/_settings -d '{ "index" : { "number_of_replicas" : 0 } }')
fi
done