Repository: chanzuckerberg/fogg
Pull request #304 (2019-06-21 23:49:17)

[fix] atlantis autoplan when modules change
This configures auto-planning when anything in modules changes. In the future we may want to build a dependency graph between modules and components (including data dependencies), but for now the brute force approach will ensure that we don't miss changes.

### Test Plan
* CI
* ran on 1 internal repo

### References
* https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#configuring-autoplanning


codecov[bot]: # [Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/304?src=pr&el=h1) Report
> Merging [#304](https://codecov.io/gh/chanzuckerberg/fogg/pull/304?src=pr&el=desc) into [master](https://codecov.io/gh/chanzuckerberg/fogg/commit/801bb71b38315e8d8fbca3c0df955dab81840838?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/chanzuckerberg/fogg/pull/304/graphs/tree.svg?width=650&token=57DhtZ7g2A&height=150&src=pr)](https://codecov.io/gh/chanzuckerberg/fogg/pull/304?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #304   +/-   ##
=======================================
  Coverage   81.38%   81.38%           
=======================================
  Files          18       18           
  Lines        1590     1590           
=======================================
  Hits         1294     1294           
  Misses        172      172           
  Partials      124      124
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/304?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/304?src=pr&el=footer). Last update [801bb71...02433a7](https://codecov.io/gh/chanzuckerberg/fogg/pull/304?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/templates/atlantis/atlantis.yaml.tmpl b/templates/atlantis/atlantis.yaml.tmpl
index 8838899a..a7259ac4 100644
--- a/templates/atlantis/atlantis.yaml.tmpl
+++ b/templates/atlantis/atlantis.yaml.tmpl
@@ -6,6 +6,9 @@ projects:
   - name: {{ $project.Name }}
     dir: {{ $project.Dir }}
     workflow: fogg
+    autoplan:
+      when_modified: ["{{ .PathToRepoRoot }}terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 {{ end }}
 
 workflows:
diff --git a/templates/repo/scripts/common.mk b/templates/repo/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/templates/repo/scripts/common.mk
+++ b/templates/repo/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/templates/repo/scripts/component.mk b/templates/repo/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/templates/repo/scripts/component.mk
+++ b/templates/repo/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \


Test patch:
diff --git a/testdata/bless_provider/scripts/common.mk b/testdata/bless_provider/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/testdata/bless_provider/scripts/common.mk
+++ b/testdata/bless_provider/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/testdata/bless_provider/scripts/component.mk b/testdata/bless_provider/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/testdata/bless_provider/scripts/component.mk
+++ b/testdata/bless_provider/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \
diff --git a/testdata/okta_provider/scripts/common.mk b/testdata/okta_provider/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/testdata/okta_provider/scripts/common.mk
+++ b/testdata/okta_provider/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/testdata/okta_provider/scripts/component.mk b/testdata/okta_provider/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/testdata/okta_provider/scripts/component.mk
+++ b/testdata/okta_provider/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \
diff --git a/testdata/snowflake_provider/scripts/common.mk b/testdata/snowflake_provider/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/testdata/snowflake_provider/scripts/common.mk
+++ b/testdata/snowflake_provider/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/testdata/snowflake_provider/scripts/component.mk b/testdata/snowflake_provider/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/testdata/snowflake_provider/scripts/component.mk
+++ b/testdata/snowflake_provider/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \
diff --git a/testdata/v1_full/scripts/common.mk b/testdata/v1_full/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/testdata/v1_full/scripts/common.mk
+++ b/testdata/v1_full/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/testdata/v1_full/scripts/component.mk b/testdata/v1_full/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/testdata/v1_full/scripts/component.mk
+++ b/testdata/v1_full/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \
diff --git a/testdata/v2_full/atlantis.yaml b/testdata/v2_full/atlantis.yaml
index e2f8dc0f..b09b3edd 100644
--- a/testdata/v2_full/atlantis.yaml
+++ b/testdata/v2_full/atlantis.yaml
@@ -9,30 +9,51 @@ projects:
   - name: accounts/bar
     dir: terraform/accounts/bar
     workflow: fogg
+    autoplan:
+      when_modified: ["../../../terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 
   - name: accounts/foo
     dir: terraform/accounts/foo
     workflow: fogg
+    autoplan:
+      when_modified: ["../../../terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 
   - name: global
     dir: terraform/global
     workflow: fogg
+    autoplan:
+      when_modified: ["../../terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 
   - name: staging/comp1
     dir: terraform/envs/staging/comp1
     workflow: fogg
+    autoplan:
+      when_modified: ["../../../../terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 
   - name: staging/comp2
     dir: terraform/envs/staging/comp2
     workflow: fogg
+    autoplan:
+      when_modified: ["../../../../terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 
   - name: staging/comp_helm_template
     dir: terraform/envs/staging/comp_helm_template
     workflow: fogg
+    autoplan:
+      when_modified: ["../../../../terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 
   - name: staging/vpc
     dir: terraform/envs/staging/vpc
     workflow: fogg
+    autoplan:
+      when_modified: ["../../../../terraform/modules/*/*.tf", "*.tf*"]
+      enabled: true
 
 
 workflows:
diff --git a/testdata/v2_full/scripts/common.mk b/testdata/v2_full/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/testdata/v2_full/scripts/common.mk
+++ b/testdata/v2_full/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/testdata/v2_full/scripts/component.mk b/testdata/v2_full/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/testdata/v2_full/scripts/component.mk
+++ b/testdata/v2_full/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \
diff --git a/testdata/v2_minimal_valid/scripts/common.mk b/testdata/v2_minimal_valid/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/testdata/v2_minimal_valid/scripts/common.mk
+++ b/testdata/v2_minimal_valid/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/testdata/v2_minimal_valid/scripts/component.mk b/testdata/v2_minimal_valid/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/testdata/v2_minimal_valid/scripts/component.mk
+++ b/testdata/v2_minimal_valid/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \
diff --git a/testdata/v2_no_aws_provider/scripts/common.mk b/testdata/v2_no_aws_provider/scripts/common.mk
index b68f50ae..cd693702 100644
--- a/testdata/v2_no_aws_provider/scripts/common.mk
+++ b/testdata/v2_no_aws_provider/scripts/common.mk
@@ -18,6 +18,7 @@ MODE ?= local
 
 ifeq ($(MODE),atlantis)
 	export AWS_CONFIG_FILE=$(REPO_ROOT)/config/atlantis-aws-config
+	TF_ARGS ?= -no-color
 endif
 
 
diff --git a/testdata/v2_no_aws_provider/scripts/component.mk b/testdata/v2_no_aws_provider/scripts/component.mk
index 790ca57d..b13842c1 100644
--- a/testdata/v2_no_aws_provider/scripts/component.mk
+++ b/testdata/v2_no_aws_provider/scripts/component.mk
@@ -17,7 +17,7 @@ check: lint check-plan
 
 fmt: terraform
 	@printf "fmt: ";
-	@for f in $(TF); do printf .; $(terraform_command) fmt $$f; done
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
 	@echo
 .PHONY: fmt
 
@@ -34,24 +34,24 @@ endif
 .PHONY: lint-tflint
 
 terraform-validate: terraform init
-	@$(terraform_command) validate -check-variables=true
+	@$(terraform_command) validate $(TF_ARGS) -check-variables=true
 .PHONY: terraform-validate
 
 lint-terraform-fmt: terraform
 	@printf "fmt check: "
 	@for f in $(TF); do \
 		printf . \
-		$(terraform_command) fmt --check=true --diff=true $$f || exit $$? ; \
+		$(terraform_command) fmt $(TF_ARGS) --check=true --diff=true $$f || exit $$? ; \
 	done
 	@echo
 .PHONY: lint-terraform-fmt
 
 ifeq ($(MODE),local)
 plan: init fmt
-	@$(terraform_command) plan
+	@$(terraform_command) plan $(TF_ARGS) -input=false
 else ifeq ($(MODE),atlantis)
 plan: init lint
-	@$(terraform_command) plan -input=false -no-color -out $(PLANFILE) | scenery
+	@$(terraform_command) plan $(TF_ARGS) -input=false -out $(PLANFILE) | scenery
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -66,10 +66,10 @@ ifneq ($(FORCE),1)
 	exit -1
 endif
 endif
-	@$(terraform_command) apply -auto-approve=$(AUTO_APPROVE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=$(AUTO_APPROVE)
 else ifeq ($(MODE),atlantis)
 apply:
-	@$(terraform_command) apply -auto-approve=true $(PLANFILE)
+	@$(terraform_command) apply $(TF_ARGS) -auto-approve=true $(PLANFILE)
 else
 	echo "Unknown mode: $(MODE)"
 	exit -1
@@ -92,7 +92,7 @@ init: terraform
 ifeq ($(MODE),local)
 	@$(terraform_command) init -input=false
 else ifeq ($(MODE),atlantis)
-	@$(terraform_command) init -input=false -no-color
+	@$(terraform_command) init $(TF_ARGS) -input=false
 else
 	@echo "Unknown MODE: $(MODE)"
 	@exit -1
@@ -100,7 +100,7 @@ endif
 .PHONY: init
 
 check-plan: init
-	@$(terraform_command) plan -detailed-exitcode; \
+	@$(terraform_command) plan $(TF_ARGS) -detailed-exitcode; \
 	ERR=$$?; \
 	if [ $$ERR -eq 0 ] ; then \
 		echo "Success"; \