Occasionally, when a PR is pushed to a VCS server, causing Terraform Enterprise (TFE) to generate a plan, the plan may fail due to issues with the VCS provider. For example, this can occur when GitHub experiences a service interruption.
The plan will not automatically re-run when the VCS provider recovers, and there is no direct way to re-run the plan in TFE.
Solutions
Recommended option: recreate PR
Delete and re-create the PR on the VCS provider. This will allow TFE to see the change as a new PR and create a new plan.
Alternative: use the remote backend
TFE’s remote backend supports running speculative plans for local configurations remotely within TFE. To run a relevant speculative plan:
- Check out the branch that represents the desired configuration locally
- Configure the backend and run
terraform init
. - Run
terraform plan
.
This method doesn’t change check results in the VCS, but does allow previewing the plan results.
Alternative: empty commit
Add an empty commit to the PR branch to trigger a new plan. This may have undesirable side effects, so deleting and re-creating the PR or using the remote backend is typically cleaner.
Last resort: amend a commit
If neither of those is an option, another possible workaround is to amend the most recent commit and force push. Depending on how your branching workflow is designed, this may allow you to keep a cleaner history and still start a new plan.
This is not recommended if you’re collaborating with many people on the same branch, but if the branch is primarily your working branch, check out the branch locally and do:
$ git commit --amend <your changes>
$ git push --force