We are using the free tier of Terraform Cloud and are running speculative plans on Github push and merges against our GCP infrastructure.
Recently we removed one of our GCP projects and even though every trace of the project is gone from both GCP and Terraform Cloud the speculative plan still tries to run for the removed workspace.
Not sure if Terraform Cloud has stored the workspace information in a internal database that still references the removed workspace or what it causing this to happen?
Are you determining that Terraform Cloud is still running speculative plans by seeing the checks appear on your pull requests?
For this situation I think it will work better to contact HashiCorp Support because they can, with your permission, look directly at your account settings to see what state things are in.
Hi @apparentlymart ,
Thanks for your reply!
Yes exactly, the check on the PR in Github starts running but never finish because that workspace has been removed.
Will contact the support instead to see if they can help us.
Does it actually start running, or do you just have it still configured as a required PR status on the GitHub side?
GitHub PR statuses that are configured as required, show up as in progress the moment a PR is created, regardless of whether the external system is still online to send updates, or not.
Thanks for your reply!
Not sure that I follow you completely. We have the Terraform Cloud OAuth app configured on our Github organization and it is set up to run speculative plans for all workspaces on push and merge, so there is no specific setting per workspace.
After removing one of our GCP projects and the workspace in Terraform Cloud the checks/speculative plans from Github still tries to run against the removed workspace on every new PR and code push and we have no way to remove the check because the workspace is already removed. We have even tried manually creating a new workspace with the same name and removing it again to see if this could get it resolved, but with no luck.
This causes the PR checks to get stuck and never finish. Please see the attached screenshot where the check/plan on the top belongs to the workspace that has been removed.
To me it feels like there is some metadata somewhere in Terraform Cloud that we cannot see that still references the removed workspace and causes the speculative plan to trigger on the non existing workspace?
If you look at the image on the right it has a “required” box. This indicates that the branch protection lists that step as having to pass to allow the PR to be merged. You will need to adjust the branch protection to remove that requirement.
Close, but not quite. The remaining configuration is in GitHub, not Terraform Cloud.
Open up your Git repository’s “Settings” tab, select “Branches” from the left sidebar, open up the relevant “Branch protection rule”, and look at the details in the “Require status checks to pass before merging” section.
That’s where you’ll find you have to tell GitHub to no longer wait for feedback from TFC.
Thanks a lot for your help @stuart-c and @maxb!
You were totally right, after finding and removing the already deleted project/workspace from the requirements in the Github branch protection rules all the check are now running successfully.