Skip to content

Commit 4c3164c

Browse files
committed
feat: more extensible clean target
1 parent 2752282 commit 4c3164c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Makefile.terraform

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
## specific TF_VAR environment variables
1111
-include local.mk
1212

13-
USER_AWS_CONFIG ?= ${HOME}/.aws
14-
TERRAFORM_DIR ?= .terraform
15-
TERRAFORM_IMAGE ?= docker.io/hashicorp/terraform
16-
TERRAFORM_VERSION ?= 1.0.7 ## Terraform is very version specific, so know what you need
17-
TERRAFORM_STATE_S3 ?= yes ## If using S3 for shared state, override this with a 'yes'
13+
DEFAULT_CLEAN_PATHS ?= *.zip *.backup $(TERRAFORM_DIR) ## Default paths for the main clean target
14+
CLEAN_PATHS ?= ## Overrideable extra paths for cleanup
1815
CONTAINER_ENGINE ?= docker ## Commands will be executed via the container engine, expected to be docker cli compatible
1916
CONTAINER_ENV ?= .env
2017
CONTAINER_WORK_DIR ?= /data
18+
TERRAFORM_DIR ?= .terraform
19+
TERRAFORM_IMAGE ?= docker.io/hashicorp/terraform
20+
TERRAFORM_VERSION ?= 1.0.7 ## Terraform is very version specific, so know what you need
21+
TERRAFORM_STATE_S3 ?= no ## If using S3 for shared state, override this with a 'yes'
22+
USER_AWS_CONFIG ?= ${HOME}/.aws
2123

2224
# Helper switches for the BASE_COMMAND
2325
ifeq ("$(USER_AWS_CONFIG)", "$(wildcard $(USER_AWS_CONFIG))")
@@ -71,8 +73,7 @@ help: ## Show this help, includes list of all actions.
7173

7274
.PHONY: clean
7375
clean: ## Cleanup the local checkout
74-
-rm -f *.zip *.backup
75-
-rm -rf $(TERRAFORM_DIR)
76+
-rm -rf $(DEFAULT_CLEAN_PATHS) $(CLEAN_PATHS)
7677

7778
.SILENT: $(CONTAINER_ENV)
7879
$(CONTAINER_ENV):

0 commit comments

Comments
 (0)