Terraform Cloud - changing VCS branch triggers plan

Hi,

We have a Terraform+Ansible project, hosted on GitLab. Our Terraform Cloud has a workspace tracking the master branch on the repository, triggered only on changes to the terraform configuration directory. That works well.

However, we are currently testing changes to our infrastructure, which currently live on a feature branch. I’ve noticed that whenever I switch between the branches in workspace VCS settings, a plan is triggered even if there were no changes in the monitored directory (e.g. an unrelated merge). Even the Trigger line in the plan says Unable to detect changed files.

Is this expected, or a bug?

Thank you,
Marko

Hello Marko,

This is the expected behaviour.

When you update the VCS settings for a workspace, Terraform Cloud will ingress the latest commit from the tracked branch and trigger a run with it.

Regards,
Filip

Thank you very much! Just needed to adjust my workflow a bit.

Hello,

Could you please advise on how to prevent automatic Terraform runs triggered by VCS changes?

Currently, whenever I create a workspace and initiate a Terraform run using the API, it also triggers an additional run automatically. As a result, I end up with two runs, with one remaining in the queue. Based on the run message, it appears that the additional run is triggered due to VCS activity.

I would like to disable the auto-trigger caused by VCS changes and manage run execution exclusively through our backend. Could you please guide me on the recommended approach to achieve this?

Thank you in advance for your assistance.