The Speakeasy Generation GitHub Action can be configured to publish a generated Terraform provider. However, Terraform providers cannot be generated with Speakeasy while operating in monorepo mode. HashiCorp requires a separate repository for the Terraform provider code that follows their naming convention and must be public. For more information, refer to the HashiCorp Terraform Registry documentation .
Use the following steps to publish a generated Terraform provider to the HashiCorp Terraform Registry.
Create a repository for the Terraform provider:
Name the repository terraform-provider-{NAME}, with the NAME containing lowercase letters.
Ensure it is a public repository.
Sign your Terraform provider releases with a signing key. Create and export a GNU Privacy Guard (GPG) signing key following the instructions in the GitHub guide to Generating a new GPG key . Generate your GPG key using either the Digital Signature Algorithm (DSA) or the Rivest–Shamir–Adleman (RSA) algorithm.
Take note of the following values:
The GPG private key.
The GPG passphrase.
The GPG public key.
Add the ASCII-armored public key to the Terraform repository.
Your GPG private key and GPG passphrase will be configured automatically when entered into the Speakeasy CLI. Ensure the following secrets are available to your repository:
The GPG private key, terraform_gpg_secret_key.
The GPG passphrase, terraform_gpg_passphrase.
The first time you create and publish a Terraform provider using the Speakeasy Generation GitHub Action, you need to manually add it to the Terraform Registry. Subsequent updates will be published automatically. To begin this process, follow the Terraform Registry instructions and agree to the Terraform terms and conditions. Note that you will need to be an organizational admin to complete this step.
Add the following file to the .github/workflows directory to create releases for the Terraform provider using GoReleaser. If all the above steps are complete, the HashiCorp registry automatically picks up new changes.
Finally, create a GoReleaser file in the root of your repository:
Whenever you generate and merge a new PR for your Terraform provider, it will be automatically versioned and released to the HashiCorp Registry.