Skip to content

forgejo_repository update fails with HTTP 500 when has_wiki=false and provider sends wiki_branch="" (Version >1.4.2) #169

Description

@misl-smlz

Bug description

When running terraform apply with terraform-provider-forgejo v1.5.0, repository update fails with:

  • Error: Unable to update repository
  • Unknown error (status 500):

From TRACE logs, provider sends wiki_branch="" while has_wiki=false in Update repository, and Forgejo responds with HTTP 500.

This appears after upgrading Terraform to versions later than 1.4.2 (currently reproduced on 1.14.9).

Versions

  • Terraform: 1.14.9 (fails)
  • terraform-provider-forgejo: v1.5.0
  • Forgejo: 15.0.3
  • OS: Linux

(Older Terraform 1.4.2 did not show this behavior in our setup.)

Reproduction

Minimal resource shape

resource "forgejo_repository" "this" {
  owner          = "it-devops"
  name           = "webshop"
  default_branch = "main"

  has_wiki       = false
  archived       = true
  has_issues     = true
  has_actions    = true
  has_projects   = false

  external_tracker = {
    external_tracker_url    = "https://jira.schmalz.com"
    external_tracker_format = "https://jira.schmalz.com/browse/{index}"
    external_tracker_style  = "alphanumeric"
  }
}
Command
TF_LOG=TRACE TF_LOG_PROVIDER=TRACE TF_LOG_PATH=forgejo-webshop.log \
terraform apply -var-file=terraform.tfvars -target='forgejo_repository.this["webshop"]'
Actual behavior
Apply fails with:
Error: Unable to update repository
Unknown error (status 500):
TRACE snippet (same request context):
[INFO] Update repository: ... has_wiki=false ... wiki_branch="" ... status="500 Internal Server Error"
[ERROR] Response contains error diagnostic: "Unknown error (status 500): "
Expected behavior
- Provider should not fail with 500 during update.
- If has_wiki=false, provider should avoid sending invalid/empty wiki-specific values (wiki_branch="") or otherwise normalize request payload so Forgejo accepts it.
- Ideally this should be a no-op update when no meaningful config changes are required.
Additional notes
In plan output, many optional fields are newly appearing and forcing in-place update, including:
- wiki_branch = ""
- default_update_style = "merge"
- allow_rebase_update = true
- allow_fast_forward_only_merge = false
- default_allow_maintainer_edit = false
- default_delete_branch_after_merge = false
The consistent failing signal in logs is has_wiki=false + wiki_branch="" followed by HTTP 500.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggoPull requests that update Go code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions