Created
February 19, 2017 16:13
-
-
Save tomelliff/cb6a829c38f69b27190c268bab679a5d to your computer and use it in GitHub Desktop.
Basic Makefile for Terraform to deploy Lambda functions
This file contains 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 characters
AWS_ACCOUNT_ID=`aws sts get-caller-identity --output text --query 'Account'` | |
bootstrap: | |
ifndef AWS_DEFAULT_REGION | |
$(error AWS_DEFAULT_REGION is not set) | |
endif | |
region_constraints='--region $(AWS_DEFAULT_REGION) --create-bucket-configuration LocationConstraint=$(AWS_DEFAULT_REGION)'; \ | |
aws s3api create-bucket --bucket tfstate-lambda-functions-$(AWS_ACCOUNT_ID) $${region_constraints} | |
remote: | |
terraform remote config -backend="S3" \ | |
-backend-config="bucket=tfstate-lambda-functions-$(AWS_ACCOUNT_ID)" \ | |
-backend-config="key=s3-sftp-bridge-$(INTEGRATION_NAME)/state" | |
get: | |
terraform get -update=true | |
plan: get remote | |
terraform plan -input=false | |
apply: get remote | |
terraform apply -input=false | |
destroy: get remote | |
terraform destroy -input=false -force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment