Expected Behavior
The terraform provider creates a webhook for the passed repository.
Expected URL should be something like: https://api.github.com/repos/ORGANIZATION/REPO/hooks
Actual Behavior
The url is constructed incorrectly, with the current user being injected into it, instead of only the organization.
Actual URL is something like: https://api.github.com/repos/LOCAL-USER/ORGANIZATION/REPO/hooks, which 404's as LOCAL-USER does not own the actual repository.
Terraform Version
OpenTofu v1.10.7
Github Provider Version (integrations/github) v6.9.0, rolling back to v6.8.3 fixes the issue for now
Affected Resource(s)
- github_repository_webhook
Terraform Configuration Files
terraform {
required_providers {
github = {
source = "integrations/github"
}
}
}
provider "github" {
token = ***
owner = "OWNER"
}
resource "github_repository_webhook" "webhook" {
repository = "ORGANIZATION/REPO"
configuration {
url = URL
secret = ***
content_type = "json"
active = true
events = var.events
}
Steps to Reproduce
- Create organizational repository
- Create token for user with org access
- Authenticate using e.g. GH CLI
- Create a github_repository_webhook resource for the org repo
terraform apply
Debug Output
* Failed to execute "tofu apply" in ./.terragrunt-cache/5xbDhd0o58dlc-OW65wpCtUfrxc/TYx-cNMOLlc0h6FEuz8-jExTYNQ
╷
│ Error: POST https://api.github.com/repos/USER/ORGANIZATION/WEBHOOK_NAME/hooks: 404 Not Found []
│
│ with MODULE.github_repository_webhook.WEBHOOK_NAME[0],
│ on .terraform/modules/MODULE/main.tf line 127, in resource "github_repository_webhook" "WEBHOOK_NAME":
│ 127: resource "github_repository_webhook" "WEBHOOK_NAME" {
│
╵
exit status 1
Panic Output
Code of Conduct
Expected Behavior
The terraform provider creates a webhook for the passed repository.
Expected URL should be something like: https://api.github.com/repos/ORGANIZATION/REPO/hooks
Actual Behavior
The url is constructed incorrectly, with the current user being injected into it, instead of only the organization.
Actual URL is something like: https://api.github.com/repos/LOCAL-USER/ORGANIZATION/REPO/hooks, which 404's as LOCAL-USER does not own the actual repository.
Terraform Version
OpenTofu v1.10.7
Github Provider Version (integrations/github) v6.9.0, rolling back to v6.8.3 fixes the issue for now
Affected Resource(s)
Terraform Configuration Files
Steps to Reproduce
terraform applyDebug Output
Panic Output
Code of Conduct