A Terraform project can accumulate more formatting, documentation, testing, and quality-check commands than anyone wants to memorize. Make records reusable commands in a project-root file named `makefile`, so the team can run a named task such as `make test`. Its simple, widely available interface helps keep workflows consistent across projects. section 7.2.2 section 7.8
A makefile defines targets and the commands they run. Targets can also name other targets as dependencies, allowing one command to group related chores. Makefile variables can be overridden on the command line. The examples declare task targets with `.PHONY`; follow the required spacing and tab formatting carefully, because Make is particular about it. section 7.2.2
Listing 7.5 Using the makefile
.PHONY: chores chores: format document #1 .PHONY: format format: terraform fmt #2 .PHONY: document document: terraform-docs -c .terraform-docs.yml . #3
The `chores` target names `format` and `document` as dependencies. Their commands run `terraform fmt` and `terraform-docs`, respectively, putting two routine Terraform tasks behind one target. section 7.2.2
Run a single task
A `hello` target containing `echo "Hello World"` can be invoked with `make hello`. Make displays the command and its output. The same target-and-command pattern can record a project's less memorable quality-control commands. section 7.2.2
