Skip to content

Commit 5a1fa9c

Browse files
committed
chore: update makefile from template
1 parent 0bd6b20 commit 5a1fa9c

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Set default shell to bash
22
SHELL := /bin/bash -o pipefail
33

4-
BUILD_TOOLS_VERSION ?= v0.13.0
4+
BUILD_TOOLS_VERSION ?= v0.14.3
55
BUILD_TOOLS_DOCKER_REPO ?= mineiros/build-tools
66
BUILD_TOOLS_DOCKER_IMAGE ?= ${BUILD_TOOLS_DOCKER_REPO}:${BUILD_TOOLS_VERSION}
77

@@ -59,6 +59,13 @@ ifdef AWS_ACCESS_KEY_ID
5959
DOCKER_AWS_FLAGS += -e AWS_SESSION_TOKEN
6060
endif
6161

62+
# If GOOGLE_CREDENTIALS is defined, we are likely running inside a GCP provider
63+
# module. To enable GCP authentication inside the docker container, we inject
64+
# the relevant environment variables (service-account key file).
65+
ifdef GOOGLE_CREDENTIALS
66+
DOCKER_GCP_FLAGS += -e GOOGLE_CREDENTIALS
67+
endif
68+
6269
# If GITHUB_OWNER is defined, we are likely running inside a GitHub provider
6370
# module. To enable GitHub authentication inside the docker container,
6471
# we inject the relevant environment variables.
@@ -87,12 +94,19 @@ test/pre-commit:
8794
test/unit-tests: DOCKER_FLAGS += ${DOCKER_SSH_FLAGS}
8895
test/unit-tests: DOCKER_FLAGS += ${DOCKER_GITHUB_FLAGS}
8996
test/unit-tests: DOCKER_FLAGS += ${DOCKER_AWS_FLAGS}
97+
test/unit-tests: DOCKER_FLAGS += ${DOCKER_GCP_FLAGS}
98+
test/unit-tests: DOCKER_FLAGS += $(shell env | grep ^TF_VAR_ | cut -d = -f 1 | xargs -i printf ' -e {}')
9099
test/unit-tests: DOCKER_FLAGS += -e TF_DATA_DIR=.terratest
91100
test/unit-tests: TEST ?= "TestUnit"
92101
test/unit-tests:
93102
@echo "${YELLOW}[TEST] ${GREEN}Start Running Go Tests in Docker Container.${RESET}"
94103
$(call go-test,./test -run $(TEST))
95104

105+
## Generate README.md with Terradoc
106+
.PHONY: terradoc
107+
terradoc:
108+
$(call quiet-command,terradoc -o README.md README.tfdoc.hcl)
109+
96110
## Clean up cache and temporary files
97111
.PHONY: clean
98112
clean:
@@ -116,11 +130,6 @@ help:
116130
} \
117131
{ lastLine = $$0 }' $(MAKEFILE_LIST)
118132

119-
## Generate README.md with Terradoc
120-
.PHONY: terradoc
121-
terradoc:
122-
$(call quiet-command,terradoc -o README.md README.tfdoc.hcl)
123-
124133
# Define helper functions
125134
DOCKER_FLAGS += ${DOCKER_RUN_FLAGS}
126135
DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE}

0 commit comments

Comments
 (0)