-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (27 loc) · 892 Bytes
/
Makefile
File metadata and controls
39 lines (27 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
include .env
TIMESTAMP := $(shell date +'%Y%m%d-%H%M%S')
VERSION := $(shell git rev-parse --short HEAD)
ZIP_FILE := $(PROJECT)-$(VERSION)-$(TIMESTAMP).zip
TERRAFORM_ARGS := \
-var profile=$(AWS_PROFILE) \
-var region=$(AWS_REGION) \
-var project=$(PROJECT) \
-var zip_file=$(ZIP_FILE)
.PHONY: venv build init plan apply destroy
all: build init apply
lambda/venv/.lock: lambda/requirements.txt
test -d lambda/venv || virtualenv -p python3 lambda/venv
. lambda/venv/bin/activate; pip install -Ur lambda/requirements.txt
touch lambda/venv/.lock
venv: lambda/venv/.lock
build: venv
mkdir -p build
cd lambda && zip -r ../build/$(ZIP_FILE) .
init:
cd terraform && terraform init $(TERRAFORM_ARGS)
plan:
cd terraform && terraform plan $(TERRAFORM_ARGS)
apply:
cd terraform && terraform apply $(TERRAFORM_ARGS)
destroy:
cd terraform && terraform destroy $(TERRAFORM_ARGS)