Skip to main content

Import from Terraform code

You can import private/public Terraform modules from Git.

Opsly generates a self-service library in the Diagram page, you can connect multiple modules (repositories) together, configure variables and export Terraform code back to deploy. This can be great for developers to build and configure their own infrastructure with no Terraform experience and without needing to touch the Terraform code.

We don't store your actual Terraform code, only the variable names.

Import Terraform modules from Git

You can import Terraform code from GitHub (Bitbucket, GitLab coming soon).

Go to the dashboard > New > Import from GitHub

Import from Github


You will be redirected to the GitHub OAuth page to grant Opsly to have Read-only access to your GitHub user account. Click Grant if you want to grant Opsly Read-only access to your organisation if you need Opsly to read repositories from the organisation as well.

When you're ready click Authorise Opsly.


Install GitHub App

We'll list you all the users and organisations that your GitHub user is associated with. You can either select a user or an organisation to grant Opsly to Read accesss to code and metadata to the repositories from that private account.

Repository Owners

As a user

If you've selected as a GitHub user, you will be redirected to install the Opsly GitHub App to grant Read accesss to code and metadata to your repositories and branches. Select your GitHub user account.

Install GitHub App

You can choose if you want to allow the GitHub App to Read access to code and metadata from All Repositories or specific ones. When you're ready click Install.

Repository Permissions

As an organsation

If you've selected as an organisation, you will get the following error message

Organisation Error

The administrator of the organisation needs to install the GitHub app and grant permissions to the repositories that you want Opsly to have access to.

Click on this link to install the GitHub App. Click Configure

Organisation GitHub App

Select the organisation (e.g Opsly)

Organisation OAuth

You can choose if you want to allow the GitHub App to Read access to code and metadata from All Repositories or specific ones. When you're ready click Install.

Organisation Repository Permissions

Import Terraform module

Once you've have succesfully installed the GitHub App granting Opsly to Read code and metadata from your repositories, you can now import the repository.

Find a repository that you would like to import (private/public). The repository path must contain .TF files.

Import TF

You can also import submodules from different branches as well.

Import TF Branch

Copy the URL from the browser bar and paste it in the Source field in Opsly. Give it a friendly name and choose a category where you can access it from the Diagram page.

Once you're ready click Create.

Import Module

You will see a green or red message depending on if your module has been succesfully imported or not. You can import as many modules as you want from the same screen and when you are ready navigate to the Diagram page.

Self-service library

In the Diagram page, if you select the the Menu > Library you will see a list of all your imported Terraform modules - you can also search for modules or select the Category where the custom module is in.



Select the modules you would like to deploy into your Cloud. You can configure the variables on the right (some have default values set but you can edit these).

Module Properties


You can connect modules with each other to build and configure the appropriate infrastructure in your Cloud. Click on the Services tab and it will list all the available services that you can connect with the module. You can also connect services that will be created from a custom module as an input to other custom modules (even those sourced from different Git Repositories).

Module Services

Export Terraform

Once you've configured the infrastructure using your custom modules, you can click Export code to download the Terraform.

As you can see below we reference the modules using source coming from your own Git repositories and pass the variables through the input.tfvars.json.

To run the Terraform code, you can read the found in the folder.

Module Terraform