Skip to content

Plugin: updater-terraform

Updates a Terraform variable that stores the application version. It is useful when Terraform modules or deployments need the new release version written into configuration.

Terminal window
semrel plugin install @semrel/updater-terraform

semrel plugin install downloads the binary to .semrel/plugins/ and updates .semrel.lock. Commit .semrel.lock to pin the version for your team.

Pre-built, signed multi-platform images (linux/amd64, linux/arm64) are published on every release:

Terminal window
docker pull ghcr.io/semrels/updater-terraform:latest

Verify the image signature with cosign:

Terminal window
cosign verify ghcr.io/semrels/updater-terraform:latest \
--certificate-identity-regexp 'https://github.com/SemRels/updater-terraform/.github/workflows/release.yml.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
version: 1
plugins:
- uses: @semrel/updater-terraform
args:
file: variables.tf
variable: app_version
NameRequiredDefaultDescription
SEMREL_PLUGIN_FILEnovariables.tfTerraform file to update.
SEMREL_PLUGIN_VARIABLEnoapp_versionTerraform variable name that stores the release version.
  • SEMREL_NEXT_VERSION
  • SEMREL_CURRENT_VERSION
  • SEMREL_TAG_NAME
  • SEMREL_DRY_RUN

For a 1.4.0 release, the updater can change default = "1.3.2" to default = "1.4.0" for the configured Terraform variable.