> 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/use-hsf/custom-harness-template-library/new-terraform-templates.md).

# Developer Environment Setup

This document will guide the user through the creation of new Terraform templates to be included in the Harness Template Library. The goal will be to guide the user through adding a new local development branch and base scaffold necessary to build a new Terraform Template.

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

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

### Walk-thru <a href="#walk-thru" id="walk-thru"></a>

*STOP: Before you proceed, make sure you review the* [*Naming Standards*](/harness-solutions-factory/3.0/troubleshooting-and-resources/best-practices/naming-convention-standards.md) *guide to ensure your new template will adhere to the project standards*

1. Open this repository in your local IDE tool
2. Open a terminal in this local path to this directory
3. Choose a new name for this template. *Don't forget to review* [*Naming Standards*](/harness-solutions-factory/3.0/troubleshooting-and-resources/best-practices/naming-convention-standards.md) *guide*
4. Create a new branch for your enhancement using the pattern - `feature/<name-for-template>`
5. Run the command `make generate type=terraform name=<name-for-template>` *Replace `<name-for-template>` with the name for the resource*

### Next Steps <a href="#next-steps" id="next-steps"></a>

Once you add the new scaffold, it is time to start building the resources. The scaffold adds the following files to the repository:

* **main.tf** - *Should contain core resource declarations and data resources used throughout the template. Additional `.tf` files can be added to further organize the resources by grouping them together.*
* **locals.tf** - *Local variable declarations and configurations*
* **outputs.tf** - *All output variables should be declared along with their descriptions*
* **providers.tf** - *Contains the Harness provider configuration block and should include any other provider configuration blocks required*
* **terraform.tf** - *Terraform settings and provider version details*
* **terraform.tfvars.example** - *Example file leveraged by end-users to generate custom `terraform.tfvars` files*
* **variables.tf** - *All user-defined variables should be placed within this file*
* **templates (directory)** - *Any Terraform `template_file` source material - e.g. Yaml template files used to define a pipeline*
* **Makefile** - *Standard Makefile included which can be used to execute standard automation*
* **README.md** - *Fully documented user guide for the new template*

#### README <a href="#readme" id="readme"></a>

To help generate the `resources`, `inputs`, and `outputs` section of the README you can use the [terraform-docs](https://terraform-docs.io/user-guide/installation/) tool to generate this for you: `terraform-docs markdown table --anchor=false .`

#### terraform.tfvars.example <a href="#terraformtfvarsexample" id="terraformtfvarsexample"></a>

This file should include all the variables from your project, their description, and their defaults, so users can easily use this to bootstrap your template. You can again use [terraform-docs](https://terraform-docs.io/user-guide/installation/) to bootstrap this: `terraform-docs tfvars hcl .`
