Reference Link: https://www.terraform.io/docs/registry/providers/publishing.html
-
Create a index.md
-
Create document for each resource and data source https://www.terraform.io/docs/registry/providers/docs.html
-
Generating Documentation https://github.com/hashicorp/terraform-plugin-docs
-
Automatically generate documentation for your provider in the format necessary for the Terraform Registry - https://github.com/hashicorp/terraform-plugin-docs
-
The terraform-provider-scaffolding template repository includes example usage of the tfplugindocs command via go generate:
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
For more details on the Document format refer : https://www.terraform.io/docs/registry/providers/docs.html#format
- Publishing a provider requires at least one version be available on GitHub Releases. The tag must be a valid Semantic Version preceded with a v (for example, v1.2.3).
List of recommend OS / architecture combinations for which we suggest most providers create binaries.
[A] Create and export a signing key that you plan on using to sign your provider releases. See Preparing and Adding a Signing Key
Create a Signing Key**
- Generate a GPG key which will be used for signing releases (https://docs.github.com/en/github/authenticating-to-github/generating-a-new-gpg-key)
- Export the public key in ASCII-armor format using the following command:
gpg --armor --export "[Key ID or email address]"
[B] Copy GoReleaser configuration from the terraform-provider-scaffolding repository
to .goreleaser.yml
file in root directory of your repository.
[C] Copy GitHub Actions workflow from the terraform-provider-scaffolding repository to .github/workflows/release.yml
in your repository.
[D] Go to Settings > Secrets in your repository, and add the following secrets :
-
GPG_PRIVATE_KEY
- It is the ASCII-armored GPG private key. It can be obtained through this commandgpg --armor --export-secret-keys [key ID or email]
-
PASSPHRASE
- It is the passphrase for your GPG private key.
[E] Push a new valid version tag (e.g. v1.2.3) to test that the GitHub Actions releaser is working.
-
There are 1 or more zip files containing the built provider binary for a single architecture
- The binary name is
terraform-provider-[NAME]_v[VERSION]
- The archive name is
terraform-provider-{NAME}_{VERSION}_{OS}_{ARCH}.zip
- The binary name is
-
There is a
terraform-provider-{NAME}_{VERSION}_SHA256SUMS
file, which contains a sha256 sum for each zip file in the release.shasum -a 256 *.zip > terraform-provider-{NAME}_{VERSION}_SHA256SUMS
-
There is a
terraform-provider-{NAME}_{VERSION}_SHA256SUMS.sig
file, which is a valid GPG binary (not ASCII armored) signature of theterraform-provider-{NAME}_{VERSION}_SHA256SUMS
file using the keypair.gpg --detach-sign terraform-provider-{NAME}_{VERSION}_SHA256SUMS
-
Release is finalized
- Sign in to the Terraform Registry with a GitHub account.
- Following permissions should be given by the GitHub account used to the provider repository you wish to publish.
- Generate a GPG key which will be used for signing releases (https://docs.github.com/en/github/authenticating-to-github/generating-a-new-gpg-key)
- Export the public key in ASCII-armor format using the following command:
gpg --armor --export "[Key ID or email address]"
- In top right navigation panel, select Publish -> Providers
- Follow the prompts to select organisation and repository.