-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
55 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,8 @@ | ||
# Auto-generated by fogg. Do not edit | ||
# Make improvements in fogg, so that everyone can benefit. | ||
|
||
TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES))) | ||
REPO_ROOT := $(shell git rev-parse --show-toplevel) | ||
REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix) | ||
# We need to do this because `terraform fmt` recurses into .terraform/modules | ||
# and wont' accept more than one file at a time. | ||
TF=$(wildcard *.tf) | ||
IMAGE_VERSION={{ .DockerImageVersion }}_TF{{ .TerraformVersion }} | ||
export DOCKER_IMAGE_VERSION :={{ .DockerImageVersion }} | ||
export TERRAFORM_VERSION := {{ .TerraformVersion }} | ||
export TF_PLUGIN_CACHE_DIR := {{ .PathToRepoRoot }}/.terraform.d/plugin-cache | ||
|
||
docker_base = \ | ||
docker run --rm -e HOME=/home -v $$HOME/.aws:/home/.aws -v $(REPO_ROOT):/repo \ | ||
-v $(REPO_ROOT)/.bin:/usr/local/bin -v $(REPO_ROOT)/terraform.d:/repo/$(REPO_RELATIVE_PATH)/terraform.d \ | ||
-e GIT_SSH_COMMAND='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ | ||
-e RUN_USER_ID=$(shell id -u) -e RUN_GROUP_ID=$(shell id -g) \ | ||
-e TF_PLUGIN_CACHE_DIR="/repo/.terraform.d/plugin-cache" -e TF="$(TF)" \ | ||
-w /repo/$(REPO_RELATIVE_PATH) $(TF_VARS) $$(sh $(REPO_ROOT)/scripts/docker-ssh-mount.sh) | ||
docker_terraform = $(docker_base) chanzuckerberg/terraform:$(IMAGE_VERSION) | ||
docker_sh = $(docker_base) --entrypoint='/bin/sh' chanzuckerberg/terraform:$(IMAGE_VERSION) | ||
|
||
all: fmt lint doc | ||
|
||
fmt: | ||
@$(docker_sh) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \ | ||
echo | ||
|
||
|
||
check: lint check-docs | ||
|
||
lint: lint-tf | ||
|
||
lint-tf: | ||
@$(docker_sh) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done' | ||
|
||
readme: | ||
bash ../../../scripts/update-readme.sh update | ||
|
||
docs: readme | ||
|
||
check-docs: | ||
@bash .update-readme.sh check; \ | ||
if [ ! $$? -eq 0 ]; then \ | ||
echo "Docs are out of date, run \`make docs\`"; \ | ||
fi | ||
|
||
clean: | ||
|
||
test: | ||
|
||
.PHONY: all check-doc clean docs fmt lint lint-tf readme test | ||
include {{ .PathToRepoRoot }}/scripts/module.mk |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Auto-generated by fogg. Do not edit | ||
# Make improvements in fogg, so that everyone can benefit. | ||
|
||
TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES))) | ||
REPO_ROOT := $(shell git rev-parse --show-toplevel) | ||
REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix) | ||
# We need to do this because `terraform fmt` recurses into .terraform/modules | ||
# and wont' accept more than one file at a time. | ||
TF=$(wildcard *.tf) | ||
IMAGE_VERSION=$(DOCKER_IMAGE_VERSION)_TF$(TERRAFORM_VERSION) | ||
|
||
docker_base = \ | ||
docker run --rm -e HOME=/home -v $$HOME/.aws:/home/.aws -v $(REPO_ROOT):/repo \ | ||
-v $(REPO_ROOT)/.bin:/usr/local/bin -v $(REPO_ROOT)/terraform.d:/repo/$(REPO_RELATIVE_PATH)/terraform.d \ | ||
-e GIT_SSH_COMMAND='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ | ||
-e RUN_USER_ID=$(shell id -u) -e RUN_GROUP_ID=$(shell id -g) \ | ||
-e TF_PLUGIN_CACHE_DIR="/repo/.terraform.d/plugin-cache" -e TF="$(TF)" \ | ||
-w /repo/$(REPO_RELATIVE_PATH) $(TF_VARS) $$(sh $(REPO_ROOT)/scripts/docker-ssh-mount.sh) | ||
docker_terraform = $(docker_base) chanzuckerberg/terraform:$(IMAGE_VERSION) | ||
docker_sh = $(docker_base) --entrypoint='/bin/sh' chanzuckerberg/terraform:$(IMAGE_VERSION) | ||
|
||
all: fmt lint doc | ||
|
||
fmt: | ||
@$(docker_sh) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \ | ||
echo | ||
|
||
|
||
check: lint check-docs | ||
|
||
lint: lint-tf | ||
|
||
lint-tf: | ||
@$(docker_sh) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done' | ||
|
||
readme: | ||
bash $(REPO_ROOT)/scripts/update-readme.sh update | ||
|
||
docs: readme | ||
|
||
check-docs: | ||
@bash $(REPO_ROOT)/scripts/update-readme.sh check; \ | ||
if [ ! $$? -eq 0 ]; then \ | ||
echo "Docs are out of date, run \`make docs\`"; \ | ||
fi | ||
|
||
clean: | ||
|
||
test: | ||
|
||
.PHONY: all check-doc clean docs fmt lint lint-tf readme test |