{% extends 'template.html' %} {% block title %}Initial Setup{% endblock %} {% block header %} {% endblock %} {% block content %}

Getting started

Progress: 0%

1. Setup required authentication environment variables

The following environment variables must be setup to be able to login:
  • ADMIN_AUTHENTICATION_TOKEN - Token to use for authorisation to be able to modify modules in the user interface. Alternatively configure SAML2 or OpenID Connect (see README.md for more information).
  • SECRET_KEY - Key used for encrypting sessions. Can be generated using: python -c 'import secrets; print(secrets.token_hex())'

Setup these environment variables and restart the Terrareg server.

2. Login

Go to the login page and login using the admin token

The admin authentication token is setup as the ADMIN_AUTHENTICATION_TOKEN environment variable.

3. Create a namespace

Go to the create namespace page and fill out the details for the namespace.

Once completed, return back to this page and refresh.

4. Create a module

Go to the create module page and fill out the details for the module.

Once completed, return back to this page and refresh.

5a. Index a module version from Git

Go to the module's integration tab, provide a version to index, select 'Publish' and click 'Index Version'.

Notice: A version has been successfully indexed, but has not been published.
Either re-index the module version, ensuring the 'Publish' checkbox has been set.
Otherwise, follow instructions for publishing a module version in the 'Upload a version' step.

5b. Upload a version of the module

  1. Create a zip/tar.gz archive with the contents of the Terraform module
  2. Upload the module by performing a POST request to the upload endpoint:
    The archive file should be supplied as a file attachment.
  3. Publish version of the module by performing a POST request to the 'publish' endpoint:
For example:
# Zip module
cd path/to/module
zip -r ../module.zip *

version=1.0.0

# Upload module version
curl -X POST \
    "" \
    -F file=@../module.zip

# Publish module version
curl -X POST \
    ""

6. Secure your Terrareg instance

To avoid unauthenticated access to some of the features, ensure to set the following environment variables:
  • UPLOAD_API_KEYS or ALLOW_MODULE_HOSTING - Either setup API keys for liming access to the module version upload endpoint or disable uploading modules entirely, enforcing the use of indexing from a Git repository
  • PUBLISH_API_KEYS - Setup API keys for limiting access to the module version publishing endpoint
  • AUTO_CREATE_NAMESPACE - Disable auto-creation of namespaces when uploading a module, enforcing creation of namespaces by authenticated users
  • AUTO_CREATE_MODULE_PROVIDER - Disable auto-creation of module providers when uploading a module, enforcing creation of modules/module providers by authenticated users

7. Enable SSL

To be able to use modules from the registry in Terraform, the instance must be configured with an SSL certificate.

Either:
  • Provide the location of an SSL certificate to Terrareg, using SSL_CERT_PRIVATE_KEY and SSL_CERT_PUBLIC_KEY environment variables;
  • Place Terrareg behind a load balancer/reverse proxy that can provide the service over HTTPS.

Complete

Congratulations!

Your Terrareg instance is all setup 🎉
{% endblock %}