How to manage secrets in Terraform

To help you manage secrets in Terraform, we’ve built a Terraform provider and a state backend. For a detailed use case, check out the beta announcement.

In this step-by-step guide, you’ll learn how to keep hardcoded secrets out of Terraform code and securely share your .tfstate file.

  1. Install the SecretHub Terraform provider
  2. Write secrets using the secrethub_secret resource
  3. Read secrets using the secrethub_secret data source
  4. Import exisiting secrets into your Terraform project
  5. Use SecretHub as a secure backend for your .tfstate

For full reference, check out the GitHub repository and the reference documentation.

Prerequisites

In this guide we assume that you have installed the SecretHub CLI, created an account and a set up a repository. To do so, you can follow these three simple steps:

  1. Install the CLI
  2. Create a free account
  3. Create a repository

Getting help

Come chat with us on Discord or email us at support@secrethub.io