Skip to content

Instantly share code, notes, and snippets.

View bensojona's full-sized avatar

Jon Benson bensojona

  • HashiCorp
  • San Francisco, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am bensojona on github.
  • I am bensojona (https://keybase.io/bensojona) on keybase.
  • I have a public key whose fingerprint is 3174 6785 84B8 9B6B 91CF 51D8 9CB6 5C78 251C A77B

To claim this, I am signing this object:

@bensojona
bensojona / tf_plan-6_with_tfvars_region_set
Last active August 26, 2015 21:34
Notice the odd behavior between `terraform plan`s. There were no changes made in-between running these commands and the environment was reset before each gist . Notice the output is different almost every time. Sometime it errors saying `"region": required field is not set`, sometimes it asks for you to enter the `region` variable then it works,…
~/projects/bensojona/tf-region-bug/terraform 🚧 master 😎 › rm -rf .terraform && rm -rf terraform.tfstate && rm -rf terraform.tfstate.backup
~/projects/bensojona/tf-region-bug/terraform 🚧 master 😎 › terraform get
Get: file:///Users/jb/projects/bensojona/tf-region-bug/terraform/network
Get: file:///Users/jb/projects/bensojona/tf-region-bug/terraform/network/vpc
~/projects/bensojona/tf-region-bug/terraform 🚧 master 😎 › terraform plan
There are warnings and/or errors related to your configuration. Please
fix these before continuing.
Errors:
@bensojona
bensojona / crash.log
Last active August 29, 2015 14:19
Terraform crashes when attempting to apply Docker images/containers to an AMI.
2015/04/24 16:53:19 [INFO] Terraform version: 0.4.2 8175d7f82134d378234a407e529853da681af07e+CHANGES
2015/04/24 16:53:19 Detected home directory from env var: /Users/jb
2015/04/24 16:53:19 [DEBUG] Discovered plugin: atlas = /usr/local/bin/terraform-provider-atlas
2015/04/24 16:53:19 [DEBUG] Discovered plugin: aws = /usr/local/bin/terraform-provider-aws
2015/04/24 16:53:19 [DEBUG] Discovered plugin: cloudflare = /usr/local/bin/terraform-provider-cloudflare
2015/04/24 16:53:19 [DEBUG] Discovered plugin: cloudstack = /usr/local/bin/terraform-provider-cloudstack
2015/04/24 16:53:19 [DEBUG] Discovered plugin: consul = /usr/local/bin/terraform-provider-consul
2015/04/24 16:53:19 [DEBUG] Discovered plugin: digitalocean = /usr/local/bin/terraform-provider-digitalocean
2015/04/24 16:53:19 [DEBUG] Discovered plugin: dme = /usr/local/bin/terraform-provider-dme
2015/04/24 16:53:19 [DEBUG] Discovered plugin: dnsimple = /usr/local/bin/terraform-provider-dnsimple
if [ -s "ssh_keys/$1-key.pem" ] && [ -s "ssh_keys/$1-key.pub" ]; then
echo Using existing $1-key pair...
else
echo No $1-key pair exists, generating new keys...
rm -rf ssh_keys/$1-key.pem
rm -rf ssh_keys/$1-key.pub
openssl genrsa -out ssh_keys/$1-key.pem 1024
chmod 400 ssh_keys/$1-key.pem
ssh-keygen -y -f ssh_keys/$1-key.pem > ssh_keys/$1-key.pub
echo ssh_keys/$1-key.pem contents...
@bensojona
bensojona / consul_main.tf
Created April 13, 2015 08:02
Consule module
resource "aws_instance" "consul" {
ami = "${var.ami}"
security_groups = ["${var.security_group}"]
key_name = "${var.key_name}"
instance_type = "${var.instance_type}"
availability_zone = "${var.availability_zone}"
count = "${var.count}"
tags {
Name = "consul_${count.index+1}"
@bensojona
bensojona / metamon_main.tf
Created April 13, 2015 08:01
Metamon module
resource "aws_instance" "metamon" {
ami = "${var.ami}"
security_groups = ["${var.security_group}"]
key_name = "${var.key_name}"
instance_type = "${var.instance_type}"
availability_zone = "${var.availability_zone}"
count = "${var.count}"
tags {
Name = "metamon_${count.index+1}"
@bensojona
bensojona / main.tf
Created April 13, 2015 08:00
Main Terraform template
provider "atlas" {
token = "${var.atlas_token}"
}
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.region}"
}
@bensojona
bensojona / terraform_error.txt
Created April 13, 2015 07:59
Attempting to create an infrastructure that will use the local-exec provisioner to call a shell script that creates a key pair on the atlas_artifact resource creation. After key pair creation, there is an aws_key_pair resource that depends on this atlas_artifact that will use the newly created public key to create the AWS key pair to be later us…
aws_security_group.allow_all: Creating...
description: "" => "Allow all inbound traffic"
egress.#: "" => "<computed>"
ingress.#: "" => "1"
ingress.532441254.cidr_blocks.#: "" => "1"
ingress.532441254.cidr_blocks.0: "" => "0.0.0.0/0"
ingress.532441254.from_port: "" => "0"
ingress.532441254.protocol: "" => "-1"
ingress.532441254.security_groups.#: "" => "0"
ingress.532441254.self: "" => "0"
Do you really want to destroy?
Terraform will delete all your managed infrastructure.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
aws_security_group.allow_all: Refreshing state... (ID: sg-54bdc030)
aws_key_pair.consul: Refreshing state... (ID: consul-key)
module.consul.aws_instance.consul.0: Refreshing state... (ID: i-8a47e177)
module.consul.aws_instance.consul.1: Refreshing state... (ID: i-bd46e040)
Refreshing Terraform state prior to plan...
aws_key_pair.consul: Refreshing state... (ID: consul-key)
aws_security_group.allow_all: Refreshing state... (ID: sg-54bdc030)
module.consul.aws_instance.consul.0: Refreshing state... (ID: i-8a47e177)
module.consul.aws_instance.consul.1: Refreshing state... (ID: i-bd46e040)
module.consul.aws_instance.consul.2: Refreshing state... (ID: i-3f46e0c2)
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources