Created
October 18, 2018 10:34
-
-
Save EricLondon/91b4c57095594549e31e6de2904d1012 to your computer and use it in GitHub Desktop.
Revisions
-
EricLondon created this gist
Oct 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ 0.11.8 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ terraform { required_version = "0.11.8" backend "s3" { bucket = "" key = "" profile = "" region = "" } } provider "aws" { profile = "${var.aws_profile}" region = "${var.aws_region}" shared_credentials_file = "${var.aws_credentials_file}" version = "1.37.0" } data "aws_caller_identity" "current" {} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ #!/usr/bin/env bash : "${AWS_PROFILE:=some-aws-profile-name}" : "${AWS_REGION:=us-east-1}" : "${STATE_BUCKET:=some-s3-state-bucket}" : "${STATE_KEY:=some-s3-state-path/terraform/base.tfstate}" action="$1" TFENV=$(which tfenv) if [ $? -eq 0 ]; then $TFENV install $(cat .terraform-version) cat .terraform-version | xargs $TFENV use fi rm -f *.tfstate rm -rf ./.terraform terraform init \ -force-copy \ -backend=true \ -backend-config "bucket=${STATE_BUCKET}" \ -backend-config "key=${STATE_KEY}" \ -backend-config "profile=${AWS_PROFILE}" \ -backend-config "region=${AWS_REGION}" terraform plan if [ "$action" == "apply" ]; then terraform apply -auto-approve fi This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ variable "aws_region" { type = "string" default = "us-east-1" } variable "aws_profile" { type = "string" default = "" } variable "aws_credentials_file" { type = "string" default = "~/.aws/credentials" }