Terraform Cloud - Runs are not being triggered automatically by Github

Hi,

I’m still new to using Terraform Cloud, setting it up for a CI/CD. I’m running into the following issue: I created a workspace and configured it’s VCS to point to a branch on my Github personal repo (outside of any organisation). When pushing new commits to this branch, the runs aren’t getting triggered automatically by Github. When I ran them manually from the UI, the run still points at the master branch and at a past commit.
Please see screenshots:

Previous commit on master only being picked up:

Workspace setup to get triggered on changes on the updates branch:

Can you please tell me if you can spot something wrong? Do I need Terraform Cloud Enterprise for that?

Best,
Kevin

Hi Kevin!

The setup looks correct to me from the workspace perspective, could you confirm if Github reflects commits to the updates branch?

There may be a few other places to check:

  • Reset the VCS Provider settings in Terraform Cloud (https://app.terraform.io/app/<org>/settings/version-control) to reconnect to your personal GitHub.

  • Check Github Applications, Terraform Cloud application should have the following permissions:

I believe there was some degradation with webhooks in the past few days that might have affected the retrieval of commits.

Let us know if it continues to be a problem.

Hello!

Thanks for your answer, removing and resetting the VCS connection helped to replay commits that were ignored. However, when pushing new commits to the branch, no run is added, it’s blocked.

Also, I checked Github Apps, I think it looks good but different than the above screenshot:

Does it look good to you too?

Thanks,
Kevin

Interesting! I wonder if the permissions aren’t quite right. Let me see if I can find someone who can check into this but in the meantime, can you confirm if you set up your VCS provider with Configuration-Free Github settings or Github.com Access (OAuth)?

If you tried Configuration-Free Github, give OAuth a try and let us know.

Hi,

I have a similar problem to this case.
I have had 2 workspaces connected to a github repository. One for develop branch and the other for master branch. Both workspaces have the same settings except VCS branch. However, the remote execution is only working on the workspace for develop branch. Nothing happens on the one for master branch. The difference between 2 is below.

develop branch:

  • commits are merged from pull request.
  • right after vcs setting was done, a manual plan(only plan, not apply) was run once on terraform cloud.

master branch:

  • commits are directly pushed from local branch.

Version Control page
Image from Gyazo
General Setting page
Image from Gyazo

run status
Image from Gyazo

Do you need to queue plan manually after workspaces are created in order to use remote execution via VCS? or else can you think of what could be my problem here?

Thank you,
Musashi

I hit this issue after having to fix some merge conflicts, Terraform Cloud just wasn’t seeing my latest commits, and running the plan manually from the UI just kept looking at the old commit. I fixed it by updating the version control settings, changing it to “CLI Driven”, and then changing it back to Version Control Driven. As soon as I did that it immediately saw the latest commits and started the plan. Hope this helps someone.

1 Like

I’m am still seeing the problem described in this issue. When I follow the advice to change VCS settings, and then set them back to the repo I want to reference, the newest commit is picked up. However all subsequent commits are ignored. Essentially you have to switch the VCS to pick up every new commit. This is still broken as far as I can tell.

Please start a new topic and describe your issues in full, afresh. Even if your issue is somewhat similar to a topic from over a year ago, it is unlikely to be identical.

Just a follow up to my previous comment in case it helps anyone out. Turns out that it you simply link a github repo to a workspace, it will link both the repo and the latest commit. It seems it remains linked to that exact commit indefinitely. If you want to have the workspace track all commits to the repo, then configure the VCS in Terraform with credentials. Then use the credentialed VCS option in the workspace when configuring repo. This seems to allow the workspace to continue to track commits. Here is a link that will guide setup.

Thanks for sharing this approach. It fixed my issue.