Custom resources

How to create and use custom resources.

Overview

Custom resources allow you to import Terraform modules as resources managed by Instruqt sandboxes. You will need to be comfortable with Terraform modules and the Terraform Registry to proceed.

This guide assumes you have published a module to the Terraform Registry. If you are curious to learn more about this feature, please reach out in your Slack organization.

Create custom resources

You can add custom resources (Terraform registry modules) using the Web UI.

  1. Click Settings -> Custom Resources.

  2. Click Import from Terraform Registry. ā†³ The Search Terraform Modules page opens.

  3. Search for and click on the Terraform module you wish to import.

  4. In the top-left corner, select the module's version and click Import.

  5. Give you resource a user-friendly name and description then confirm by clicking Import.

Use custom resources

You can add custom resources to sandboxes using the Web UI.

  1. Click the track you want to add custom resources to.

  2. In the Sandbox section of the Track dashboard, click Edit.

  3. On the Sandbox page, click Add a custom resource.

  4. Select the custom resource you want to add.

  5. Input a name, and customize inputs if any are presented.

  6. Click Add resource in the upper-right corner.

The sandbox_id value is a reserved input name, and cannot be used for custom resources.

Accessing Resource Outputs

Custom Resources are provisioned ahead of other sandbox components. Outputs from these Terraform modules are provided as environment variables to host lifecycle scripts. The environment variable will be prefixed with the name given to the custom resource when added to the sandbox.

As an example, if you have a Custom Resource named sqldb that yields an output ENDPOINT, it will be available as an environment variable named $SQLDB_ENDPOINT.

Last updated