> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-solutions-factory/3.0/troubleshooting-and-resources/configurations/local-testing-using-make.md).

# Local Testing Using Make

This document details the available Makefile commands. The goal is to simplify the various commands to rapid testing and prototyping.

### Before you begin <a href="#prerequisites" id="prerequisites"></a>

This document assumes that your local development environment has followed the steps outline in the [Developer Environment Setup](/harness-solutions-factory/use-hsf/configurations/developer-env-setup.md) guide. Please review those requirements to ensure that you have all the tools necessary to proceed.

### Commands <a href="#commands" id="commands"></a>

*Note: a local list of available target commands can be printed by running the command `make help`*

#### Terraform controls <a href="#terraform-controls" id="terraform-controls"></a>

| Command            | Description                                                                                                                                           | Notes                                                                                                                   |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| init \[migrate]    | executes Terraform/Tofu `init`                                                                                                                        | If the command includes `migrate`, then any local `backed.tf` will be removed and a `-migrate-state` will be performed. |
| plan               | Executes a Terraform/Tofu `plan`                                                                                                                      |                                                                                                                         |
| plan\_output       | Executes a Terraform/Tofu `plan` includes generating a tfplan file in the local directory                                                             |                                                                                                                         |
| plan\_show         | Executes a Terraform/Tofu `show` on a previously generated terraform.tfplan file and stores the file in human-readable format as terraform.tfplan.out |                                                                                                                         |
| apply              | Automatically runs a Terraform/Tofu `apply`                                                                                                           |                                                                                                                         |
| destroy            | Automatically runs a Terraform/Tofu `destroy`                                                                                                         |                                                                                                                         |
| refresh            | Refreshes the statefile                                                                                                                               |                                                                                                                         |
| output \[RESOURCE] | Display the Terraform/Tofu outputs                                                                                                                    | To return a single output, pass `RESOURCE=<terraform-output-name>`                                                      |
| fmt                | Formats the Terraform files in the current directory                                                                                                  |                                                                                                                         |
| fmt\_all           | Formats all Terraform files in the entire repository                                                                                                  |                                                                                                                         |
| testing\_cleanup   | Removes the local `.terraform` and `.terraform.lock.hcl` files.                                                                                       |                                                                                                                         |
| debug              | Loads the current directory into the container to allow running commands locally                                                                      |                                                                                                                         |
| help               | Prints all of the local targets                                                                                                                       |                                                                                                                         |

#### Terraform test suites <a href="#terraform-test-suites" id="terraform-test-suites"></a>

| Command                | Description                                                               | Notes                                                                                                                 |
| ---------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| cycle                  | Idempotency Check                                                         | Runs the commands - init, destroy, apply, and plan                                                                    |
| teardown               | Full Suite Cleanup                                                        | Runs the commands - destroy and testing\_cleanup                                                                      |
| deploy \[dryrun]       | Applies the Terraform template                                            | Runs the commands - init, plan, and apply. Note: If the argument `dryrun` is passed then the `apply` step is skipped. |
| all                    | End-to-end testing                                                        | Runs the commands - init, fmt, plan, apply, destroy, testing\_cleanup                                                 |
| version\_tests \[type] | Runs an entire suite of executions for a template based on the chose type | Supported types: terraform or tofu - e.g `type=tofu`                                                                  |
| full\_suite            | Cycles a full End-to-end testing for all versions listed                  | Reads all versions in the .terraform\_verions and .tofu\_versions files.                                              |

#### Scaffold controls <a href="#scaffold-controls" id="scaffold-controls"></a>

| Command                         | Description                                    | Notes                                                                              |
| ------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------- |
| generate type=terraform \[name] | Generate a new directory using a template type | The argument `name=<new-template-name>` needs to be passed along with this command |
