- 15 mins Introduction
Per interview.
| #!/opt/puppetlabs/puppet/bin/ruby | |
| # This mini-webserver is meant to be run as the peadmin user | |
| # so that it can call mcollective from a puppetmaster | |
| # Authors: | |
| # Ben Ford | |
| # Adam Crews | |
| # Zack Smith | |
| # Jeff Malnick | |
| require 'rubygems' |
| Warning - actual ignitition not guaranteed to occur. No Ben's were harmed during the making of this tweet. |
| My root partition mounted read only too. To fix, I ran: | |
| blkid | |
| to get the disk's new UUID, and then updated /etc/fstab with the new value: | |
| cp /etc/fstab /run | |
| vim /run/fstab | |
| mount --no-mtab --fstab /run/fstab -o remount,rw / | |
| cp /run/fstab /etc | |
| reboot |
| * aws_route53_record.riemann_private: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue. | |
| Please include the following information in your report: | |
| Terraform Version: 0.8.1 | |
| Resource ID: aws_route53_record.riemann_private | |
| Mismatch reason: attribute mismatch: records.1515779551 | |
| Diff One (usually from plan): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"ttl":*terraform.ResourceAttrDiff{Old:"", New:"300", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "fqdn":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "zone_id":*terraform.ResourceAttrDiff{Old:"", New:"Z2FZI4D6465RDO", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "records.#":*terraform.ResourceAtt |
| #!/bin/bash | |
| type terraform >/dev/null 2>&1 || { echo >&2 "I require terraform but it's not installed. Quitting sadly."; exit 1; } | |
| REGION="us-east-1" | |
| BUCKET="remote_state" | |
| ENVIRONMENT=${PWD##*/} | |
| STATE_FILE="terraform.tfstate" | |
| ARGS=$* |
Terraform can also store modules in an S3 bucket. To access the bucket you must have appropriate AWS credentials in your configuration or available via shared credentials or environment variables.
There are a variety of S3 bucket addressing schemes, most are documented in the S3 configuration. Here are a couple of examples:
| #!/usr/bin/env bash | |
| set -e | |
| # Formats any *.tf files according to the hashicorp convention | |
| files=$(git diff --cached --name-only) | |
| for f in $files | |
| do | |
| if [ -e "$f" ] && [[ $f == *.tf ]]; then | |
| #terraform validate `dirname $f` | |
| terraform fmt $f |
| env TF_LOG=DEBUG terraform get -update | |
| 2016/10/15 05:59:20 [INFO] Terraform version: 0.7.6 754bdda8a78b24efab62f1dc24d97c1c02d89fe9 | |
| 2016/10/15 05:59:20 [INFO] CLI args: []string{"/usr/local/bin/terraform", "get", "-update"} | |
| 2016/10/15 05:59:20 [DEBUG] Detected home directory from env var: /Users/james | |
| 2016/10/15 05:59:20 [DEBUG] Detected home directory from env var: /Users/james | |
| 2016/10/15 05:59:20 [DEBUG] Attempting to open CLI config file: /Users/james/.terraformrc | |
| 2016/10/15 05:59:20 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
| 2016/10/15 05:59:20 [DEBUG] Detected home directory from env var: /Users/james | |
| Get: git::https://github.com/turnbullpublishing/tf_api.git (update) | |
| Get: git::ssh://[email protected]/turnbullpublishing/tf_vpc.git?ref=v0.0.2 (update) |
| 2016/09/30 14:45:10 [INFO] Terraform version: 0.7.4 84592f5967490d118aae0b61a25d589d269fd0b6 | |
| 2016/09/30 14:45:10 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"} | |
| 2016/09/30 14:45:10 [DEBUG] Detected home directory from env var: /Users/james | |
| 2016/09/30 14:45:10 [DEBUG] Detected home directory from env var: /Users/james | |
| 2016/09/30 14:45:10 [DEBUG] Attempting to open CLI config file: /Users/james/.terraformrc | |
| 2016/09/30 14:45:10 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
| 2016/09/30 14:45:10 [DEBUG] Detected home directory from env var: /Users/james | |
| 2016/09/30 14:45:10 [DEBUG] DestroyEdgeInclude: Checking: aws_instance.base | |
| 2016/09/30 14:45:10 [DEBUG] DestroyEdgeInclude: Checking: aws_instance.base | |
| 2016/09/30 14:45:10 [TRACE] Graph after step *terraform.DestroyTransformer: |