Terraform
- Terraform Enterprise
- 1.2.x
- 1.1.x
- 1.0.x
- v202507-1
- v202506-1
- v202505-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202411-1
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- v202408-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202404-1
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-2
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-2
- v202208-1
- v202207-2
- v202207-1
- v202206-1
Pre-upgrade checks
Pre-upgrade checks help you validate Terraform Enterprise configuration and dependency readiness before applying an upgrade.
Overview
Complete the following steps to run pre-upgrade checks for your runtime:
- Pull the target image: Obtain the Terraform Enterprise image for the version you plan to upgrade to.
- Replicate your configuration: Use the same environment variables, secrets, volumes, and network settings as your running deployment.
- Override the entrypoint: Run the container with
/usr/local/bin/preupgrade-checkas the entrypoint instead of the default application startup. - Review the output: Examine the logs to identify any configuration issues, dependency problems, or warnings.
- Clean up: Remove temporary resources created for the check.
Refer to the instructions for your runtime for details.
Requirements
Run the pre-upgrade check using the same Terraform Enterprise configuration as your live deployment:
- core database settings
- license
- hostname
- object storage settings
- Redis settings when applicable
- Vault settings
Additionally, you must include any mounted CA bundles or mTLS certificate files that your deployment uses.
Nomad
You must run the check as a batch job. Nomad variables are path-scoped, so you must create a separate Nomad variable for the preupgrade-check job to provide access to the necessary secrets. Copy the same environment variables, secret values, and mounted certificate files that your running Terraform Enterprise job uses.
Read the secrets from your existing Terraform Enterprise job and create a matching variable for the batch job. Include any registry credentials that the pre-upgrade job needs to pull the target Terraform Enterprise image. The following example uses placeholder values for the
Itemsobject. Replace these with the actual secrets from your original job:NAMESPACE="terraform-enterprise" # View existing secrets to copy the values nomad var get -namespace="$NAMESPACE" nomad/jobs/tfe-job/tfe-group/tfe-task # Create the variable for the pre-upgrade check cat > /tmp/preupgrade-var.json << 'EOF' { "Namespace": "terraform-enterprise", "Path": "nomad/jobs/preupgrade-check", "Items": { "db_password": "<same-as-tfe-job>", "redis_password": "<same-as-tfe-job>", "redis_sidekiq_password": "<same-as-tfe-job>", "registry_username": "<registry-username>", "registry_password": "<registry-password>", "tfe_license": "<tfe-license-content>" } } EOF # Submit the new variable curl -s -X PUT -H "X-Nomad-Token: $NOMAD_TOKEN" \ "$NOMAD_ADDR/v1/var/nomad/jobs/preupgrade-check?namespace=$NAMESPACE" \ -d @/tmp/preupgrade-var.json # Remove the temporary JSON file rm /tmp/preupgrade-var.jsonCreate a
preupgrade-check.nomad.jsonbatch job file. Copy the environment variables from your running Terraform Enterprise job and use the same host volume for your TLS certificates. Ensure the Docker driver configuration usesentrypointinstead ofcommand. If your Terraform Enterprise image requires registry authentication, add the Dockerauthblock shown in the following example. The example contains placeholder values and variable references that you must update for your environment.{ "Job": { "ID": "preupgrade-check", "Name": "preupgrade-check", "Type": "batch", "TaskGroups": [ { "Name": "check-group", "Count": 1, "Tasks": [ { "Name": "preupgrade-check", "Driver": "docker", "Config": { "image": "images.releases.hashicorp.com/hashicorp/terraform-enterprise:<target-version>", "entrypoint": ["/usr/local/bin/preupgrade-check"], "auth": { "username": "${REGISTRY_USERNAME}", "password": "${REGISTRY_PASSWORD}" } }, "Templates": [ { "DestPath": "/secrets/secrets.env", "Envvars": true, "EmbeddedTmpl": "{{- with nomadVar \"nomad/jobs/preupgrade-check\" -}}\nREGISTRY_USERNAME=\"{{ .registry_username }}\"\nREGISTRY_PASSWORD=\"{{ .registry_password }}\"\nTFE_DATABASE_PASSWORD=\"{{ .db_password }}\"\n... (abbreviated) ...\nTFE_LICENSE={{ .tfe_license }}\n{{- end -}}" } ], "Env": { "TFE_DATABASE_HOST": "<rds-endpoint>:5432", "TFE_DATABASE_NAME": "hashicorp", "...": "...", "TFE_OPERATIONAL_MODE": "active-active" } } ] } ] } }Submit the batch job:
nomad job run -namespace="$NAMESPACE" preupgrade-check.nomad.jsonReview the output logs for the job. Nomad garbage-collects completed batch allocations, so you must retrieve the logs promptly before they are deleted:
# Get the allocation ID ALLOC_ID=$(nomad job allocs -namespace="$NAMESPACE" -json preupgrade-check | jq -r '.[0].ID') # Stream logs in real-time nomad alloc logs -f -namespace="$NAMESPACE" "$ALLOC_ID"Clean up the batch job and optionally remove the variable:
nomad job stop -namespace="$NAMESPACE" -purge preupgrade-check # Optional: remove the Nomad variable nomad var purge -namespace="$NAMESPACE" nomad/jobs/preupgrade-check
Kubernetes
Terraform Enterprise on Kubernetes uses a Helm-based pre-upgrade workflow.
- Enable the check for the validation run by setting
preupgradeCheck.enabled=truein your override values. - Choose validation mode:
- Add
preupgradeCheck.tfeNamespace=trueto your values enable existing namespace mode. Use this mode for non-mutating validation in the live namespace. - Add
preupgradeCheck.tfeNamespace=falseto your values file to enable fresh namespace mode. Use this mode for isolated validation and simple cleanup.
- Add
- Run the pre-upgrade check and review the output before starting the upgrade.
For complete commands and examples, refer to the Helm chart runbook:
OpenShift
OpenShift deployments use the same Helm-based pre-upgrade check workflow as Kubernetes.
In addition to enabling pre-upgrade checks, set openshift.enabled=true in your override values for OpenShift environments.
For command-level instructions, refer to the same Helm runbook:
Podman
The Podman workflow is identical to Docker. Replace docker with podman in the commands in the Docker section.
If you use Quadlet to manage Terraform Enterprise, you can create a one-shot .container unit file to run the check. Otherwise, use podman compose or the standalone podman run workflow.
Docker
You can run the pre-upgrade check using Docker Compose or standalone Docker commands. We recommend using a Docker Compose override so you can run the pre-upgrade check with the same environment variables, volumes, and network settings as your existing deployment.
Docker Compose
Pull the target image:
docker pull images.releases.hashicorp.com/hashicorp/terraform-enterprise:<target-version>Create an override compose file:
cat > compose.preupgrade.yaml << 'EOF' services: tfe: image: images.releases.hashicorp.com/hashicorp/terraform-enterprise:<target-version> entrypoint: ["/usr/local/bin/preupgrade-check"] ports: [] restart: "no" EOFRun the check:
docker compose -f compose.yaml -f compose.preupgrade.yaml run --rm tfeRemove the override file:
rm compose.preupgrade.yaml
Standalone Docker
If you do not use Docker Compose, you can run the check directly with docker run. Start by extracting the Terraform Enterprise environment variables from the running container, then add any other runtime environment variables that your deployment depends on. In particular, if your deployment uses an HTTP proxy to reach external services, include the appropriate proxy variables, such as http_proxy, https_proxy, and no_proxy.
Create an environment file using the running container as a starting point:
docker exec <tfe-container-name> env | grep '^TFE_' > /tmp/tfe.envReview
/tmp/tfe.envand add any additional environment variables required by your environment, such as HTTP proxy configuration variables.Run the check:
docker run --rm \ --entrypoint /usr/local/bin/preupgrade-check \ --env-file /tmp/tfe.env \ -v /etc/tfe/ssl:/etc/ssl/private/terraform-enterprise:ro \ images.releases.hashicorp.com/hashicorp/terraform-enterprise:<target-version>Remove the environment file:
rm /tmp/tfe.env
Interpret the results
After you run the check, review the output logs to determine the status of your configuration, license, and external dependencies. The process exits with one of the following codes:
| Exit code | Description | Status |
|---|---|---|
0 | All checks passed with no warnings. | Clear to upgrade. |
1 | One or more checks failed. | Fix the listed errors and rerun the check before upgrading. |
2 | A bootstrap error occurred. The check could not run due to a configuration problem or unreachable infrastructure. | Resolve the configuration or connectivity issue, then rerun the check. |
3 | All checks passed but generated warnings. | Review the warnings before proceeding. |