11# Set default shell to bash
22SHELL := /bin/bash -o pipefail
33
4- BUILD_TOOLS_VERSION ?= v0.13.0
4+ BUILD_TOOLS_VERSION ?= v0.14.3
55BUILD_TOOLS_DOCKER_REPO ?= mineiros/build-tools
66BUILD_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
6060endif
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:
8794test/unit-tests : DOCKER_FLAGS += ${DOCKER_SSH_FLAGS}
8895test/unit-tests : DOCKER_FLAGS += ${DOCKER_GITHUB_FLAGS}
8996test/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 {}')
9099test/unit-tests : DOCKER_FLAGS += -e TF_DATA_DIR=.terratest
91100test/unit-tests : TEST ?= "TestUnit"
92101test/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
98112clean :
@@ -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
125134DOCKER_FLAGS += ${DOCKER_RUN_FLAGS}
126135DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE}
0 commit comments