Create Your First Template
Templates are the way to add your Terraform code to env0. You will need to tell env0 how to connect to your VCS, and where to find your Terraform code.
Create Your Template
- Open the Organization Templates page
- Click on Create new template
- Choose your desired template type
- Enter a name for your template in
Template Name
, and then click on NEXT
- Pick the type of VCS that holds your git repository:
GitHub
,GitLab
,Bitbucket
or another VCS.
- Please follow the next sections per your VCS integration:
GitHub
- After clicking on "GitHub.com" button for the first time, you will get a popup from GitHub asking you to install the
env0
GitHub App on a GitHub organization. Pick the GitHub organization containing your Terraform repository.
- Pick the repositories you want env0 GitHub App to have access to, and install the GitHub App
- The popup GitHub window will close.
- Pick the GitHub repository that contains the code for this template
- If you would like to pull the code from a specific revision or branch, enter that in the
Revision
field. Leaving this field empty will use your default branch, which is usually âmasterâ/"main". - Enter the folder your IaC files are located in under
Terraform Folder
orTerragrunt Folder
. If your IaC files are in the root of the repository, leave this empty. - Click on NEXT to go to the next step, Variables
GitLab
- After clicking on the "GitLab.com" button for the first time, you will get a popup from GitLab asking you to authorize the
env0
GitLab application access to your repositories using your account.
- The GitLab popup will close.
- Pick the GitLab repository that contains the code for this template
- If you would like to pull the code from a specific revision or branch, enter that in the
Revision
field. Leaving this field empty will use your default branch, which is usually âmasterâ/"main". - Enter the folder your IaC files are located in under
Terraform Folder
orTerragrunt Folder
. If your IaC files are in the root of the repository, leave this empty. - Click on NEXT to go to the next step, Variables
Bitbucket
- After clicking on the "Bitbucket.org" button for the first time, you will get a popup from Bitbucket asking you to authorize the
env0
Bitbucket application access to your workspace using your account.
- The Bitbucket popup will close.
- Pick the Bitbucket repository that contains the code for this template.
- If you would like to pull the code from a specific revision or branch, enter that in the
Revision
field. Leaving this field empty will use your default branch, which is usually âmasterâ/"main". - Enter the repository sub-folder your IaC files are located in under
Terraform Folder
orTerragrunt Folder
. If your IaC files are in the root of the repository, leave this empty. - Click on NEXT to go to the next step, Variables
Azure DevOps
- After clicking on "Azure DevOps" button for the first time, you will get a popup from Azure DevOps asking you to authorize the
env0
Azure DevOps application access to your repositories using your account. Grant access for the app.
- The Azure DevOps popup will close.
- Pick the Azure DevOps repository that contains the code for this template
- If you would like to pull the code from a specific revision or branch, enter that in the
Branch
field. Leaving this field empty will use your default branch, which is usually âmasterâ/"main". - Enter the folder your IaC files are located in under
<IaC> Folder
(IaC being the template type you chose earlier). If your IaC files are in the root of the repository, leave this empty. - Click on NEXT to go to the next step, Variables
Notice
You must enable the
Third-party application access via OAuth
underOrganization Settings/Security/Policies
for any organization you wish to manage repositories for
Other VCS
1.. Enter the URL to your Terraform repository that contains the code for this template under "Repository URL" - The URL can either be an HTTP/S URL or an SSH URL
- If you would like to pull the code from a specific revision or branch, enter that in the
Revision
field. Leaving this field empty will use your default branch, which is usually âmasterâ/"main". - Enter the folder your Terraform files are located in under
Terraform Folder
. If your Terraform files are in the root of the repository, leave this empty. - If your repository is private - use the
SSH Keys
orGit Token
dropdown, to select the keys/tokens you created in the Connecting your VCS stage. - Click on NEXT to go to the next step, Variables
Variables
- In the variables section, you can now enter environment variables and terraform variables that will be used when deploying this template. For more info Variables
- When you're done adding variables, click on NEXT to go to the final step, Projects
Projects
- Pick the projects that you'd like to allow to deploy this template.
- Click on DONE when you're done to create the template.
Add Your Template To a Project
In order to run the template, youâll need to add it to one of the organization's Projects. Your new organization will already have a Default Project.
- Go to the Default Organization Project
- Click the Project Templates page in the left menu.
- Click Manage and check the checkbox next to the template youâve created.
- Click Save
Additional Content
Updated 6 months ago
Wonderful! Youâve connected your VCS to env0, and created your first template!