diff options
author | Kenny Ballou <kballou@devnulllabs.io> | 2018-04-09 21:50:35 -0600 |
---|---|---|
committer | Kenny Ballou <kballou@devnulllabs.io> | 2018-08-19 11:31:21 -0600 |
commit | 655ef46f50d95209c39da1aa26a2d1c520b77193 (patch) | |
tree | 97835230a553c98a93b187acb146c6f604d97301 /Makefile | |
parent | 23ac5f2751e92e71da00e35753259b44d1aad1ab (diff) | |
download | kennyballou.com-655ef46f50d95209c39da1aa26a2d1c520b77193.tar.gz kennyballou.com-655ef46f50d95209c39da1aa26a2d1c520b77193.tar.xz |
Add cloudformation templates and tooling
Blag will be managed using cloudfront/S3/lambdaedge, specified via
cloudformation.
Signed-off-by: Kenny Ballou <kballou@devnulllabs.io>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2acd93f --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +PROJROOT:=$(git rev-parse --show-toplevel) + +AG:=autogen +JQ:=jq +JQ_OPTIONS:= +REGION?=us-east-1 +BUILD_DIR:=_build/$(REGION) +VERBOSE?=0 + +ifeq ($(VERBOSE),1) + VFILTER := +else + VFILTER :=>/dev/null +endif + +SOURCE_TEMPLATES:=$(wildcard stacks/*.tpl) +SOURCE_PARAMS:=$(wildcard params/*.tpl) +TEMPLATES:=$(patsubst %.tpl, $(BUILD_DIR)/%.template, $(SOURCE_TEMPLATES)) +STACK_PARAMS:=$(patsubst %.tpl, $(BUILD_DIR)/%.params, $(SOURCE_PARAMS)) + +SOURCES:=$(shell find stacks/ -type f -name '*.in') + +.PHONY: all +all: autogen/stack.def \ + $(TEMPLATES) \ + $(STACK_PARAMS) + +autogen/stack.def: autogen/stack.def.in + cat $^ > $@ + +$(BUILD_DIR)/%.json: %.tpl $(SOURCES) + mkdir -p $(dir $@) + $(AG) --override-tpl=$< --definitions=autogen/stack.def > $@ + +$(BUILD_DIR)/%.template: $(BUILD_DIR)/%.json + $(JQ) . $< > $@ + +$(BUILD_DIR)/%.params: $(BUILD_DIR)/%.json + $(JQ) '.' $< > $@ + +.PHONY: clean +clean: + -rm -r $(BUILD_DIR) |