Problem
When you configure a workspace in Terraform Enterprise or HCP Terraform to use an Azure DevOps repository, the integration creates webhook subscriptions for certain event types. However, for configurations created before May 2021, these service hook registrations may not appear in the Service Hooks section of your Azure DevOps project settings.
The affected event types are:
git.pullrequest.createdgit.pullrequest.updatedgit.push
Cause
This issue occurs because older versions of Terraform Enterprise and HCP Terraform did not include the Project ID in the payload when creating a webhook subscription, which is an expectation of the Azure DevOps API.
Solutions
To resolve this issue, you must recreate the webhook subscriptions by disconnecting and reconnecting the VCS repository from all associated components.
For Terraform Enterprise
- Upgrade your instance to version
v202105-1or higher. - Disassociate all workspaces, modules, and policy sets from the affected Azure DevOps repository.
- For a workspace, navigate to Settings > Version Control and select Change Source to temporarily use a different source.
- For a module or policy set, you must delete and recreate it.
- Reconnect the workspaces, modules, and policy sets to the Azure DevOps repository. This action triggers the creation of new, correctly configured webhook subscriptions.
For HCP Terraform
- Disassociate all workspaces, modules, and policy sets from the affected Azure DevOps repository.
- For a workspace, navigate to Settings > Version Control and select Change Source to temporarily use a different source.
- For a module or policy set, you must delete and recreate it.
- Reconnect the workspaces, modules, and policy sets to the Azure DevOps repository. This action triggers the creation of new, correctly configured webhook subscriptions.
Outcome
After you complete these steps, the webhook subscriptions created by Terraform Enterprise or HCP Terraform will appear correctly under the Service Hooks section of your Azure DevOps project settings page.
Additional Information
- Terraform Enterprise and HCP Terraform use the following Azure DevOps APIs to manage webhook subscriptions:
- To successfully recreate the webhook subscriptions, you must first disconnect all associated workspaces, modules, and policy sets from the VCS repository. A complete disconnection is required to trigger the destruction of the old webhooks before the new ones can be created upon reconnection.