Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Set bash unofficial strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail

# Enable for enhanced debugging
#set -vx
# Set DEBUG to true for enhanced debugging: run prefixed with "DEBUG=true"
${DEBUG:-false} && set -vx
# Credit to https://stackoverflow.com/a/17805088
# and http://wiki.bash-hackers.org/scripting/debuggingtips
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
Expand Down
14 changes: 11 additions & 3 deletions bin/terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
set -euo pipefail
#IFS=$'\n\t'

# Enable for enhanced debugging
#set -vx
# Set DEBUG to true for enhanced debugging: run prefixed with "DEBUG=true"
${DEBUG:-false} && set -vx
# Credit to https://stackoverflow.com/a/17805088
# and http://wiki.bash-hackers.org/scripting/debuggingtips
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
Expand Down Expand Up @@ -61,7 +61,11 @@ function plan() {
> "$output"
retcode="$?"
set -e
$DOCKER_LANDSCAPE - < "$output"
if [[ "$retcode" = 0 ]]; then
$DOCKER_LANDSCAPE - < "$output"
else
cat "$output"
fi
rm -f "$output"
return "$retcode"
}
Expand All @@ -84,6 +88,10 @@ function apply() {
$DOCKER_TERRAFORM apply \
-lock=true \
"$TF_PLAN"
$DOCKER_TERRAFORM output
}

function output() {
}

case "$verb" in
Expand Down
6 changes: 3 additions & 3 deletions bin/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Set bash unofficial strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail

# Enable for enhanced debugging
#set -vx
# Set DEBUG to true for enhanced debugging: run prefixed with "DEBUG=true"
${DEBUG:-false} && set -vx

# Credit to http://stackoverflow.com/a/246128/424301
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down
20 changes: 20 additions & 0 deletions terraform/aws.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Thanks @marcosdiez for the suggestion
# This makes it super-clear which AWS account, arn, and user_id are in use
# in a way that can be conveniently tracked in the output of CI tools
provider "aws" {
region = "${var.aws_region}"
}

data "aws_caller_identity" "current" {}

output "account_id" {
value = "${data.aws_caller_identity.current.account_id}"
}

output "arn" {
value = "${data.aws_caller_identity.current.arn}"
}

output "user_id" {
value = "${data.aws_caller_identity.current.user_id}"
}
6 changes: 0 additions & 6 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ variable "public_key_file" {
default = "~/.ssh/id_rsa.pub"
}

data "aws_caller_identity" "current" {}

output "account_id" {
value = "${data.aws_caller_identity.current.account_id}"
}

variable "aws_account_id_for_ami" {
description = "AWS Account ID where AMIs live, if not the default"
default = ""
Expand Down