Repository: chanzuckerberg/fogg
Pull request #308 (2019-06-25 19:19:46)

[fix] Fix linting in modules
### Summary
`/bin/bash: c: command not found`

### Test Plan
applied + tested




Patch:
diff --git a/templates/repo/scripts/module.mk b/templates/repo/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/templates/repo/scripts/module.mk
+++ b/templates/repo/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-


Test patch:
diff --git a/testdata/bless_provider/scripts/module.mk b/testdata/bless_provider/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/testdata/bless_provider/scripts/module.mk
+++ b/testdata/bless_provider/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-
diff --git a/testdata/okta_provider/scripts/module.mk b/testdata/okta_provider/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/testdata/okta_provider/scripts/module.mk
+++ b/testdata/okta_provider/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-
diff --git a/testdata/snowflake_provider/scripts/module.mk b/testdata/snowflake_provider/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/testdata/snowflake_provider/scripts/module.mk
+++ b/testdata/snowflake_provider/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-
diff --git a/testdata/v1_full/scripts/module.mk b/testdata/v1_full/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/testdata/v1_full/scripts/module.mk
+++ b/testdata/v1_full/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-
diff --git a/testdata/v2_full/scripts/module.mk b/testdata/v2_full/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/testdata/v2_full/scripts/module.mk
+++ b/testdata/v2_full/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-
diff --git a/testdata/v2_minimal_valid/scripts/module.mk b/testdata/v2_minimal_valid/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/testdata/v2_minimal_valid/scripts/module.mk
+++ b/testdata/v2_minimal_valid/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-
diff --git a/testdata/v2_no_aws_provider/scripts/module.mk b/testdata/v2_no_aws_provider/scripts/module.mk
index 049914b8..5b1dec24 100644
--- a/testdata/v2_no_aws_provider/scripts/module.mk
+++ b/testdata/v2_no_aws_provider/scripts/module.mk
@@ -9,8 +9,9 @@ all: fmt lint doc
 .PHONY: all
 
 fmt: terraform
-	$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt $$f; done'; \
-	echo
+	@printf "fmt: ";
+	@for f in $(TF); do printf .; $(terraform_command) fmt $(TF_ARGS) $$f; done
+	@echo
 .PHONY: fmt
 
 check: lint check-docs
@@ -20,7 +21,11 @@ lint: lint-tf
 .PHONY: lint
 
 lint-tf: terraform
-	@$(sh_command) -c 'for f in $(TF); do printf .; terraform fmt --check=true --diff=true $$f || exit $$? ; done'
+	@printf "fmt: ";
+	@for f in $(TF); do \
+	  printf .; $(terraform_command) fmt $(TF_ARGS) --check=true --diff=true || exit $$? ; \
+	done
+	@echo
 .PHONY: lint-tf
 
 readme:
@@ -42,4 +47,3 @@ clean:
 
 test:
 .PHONY: test
-