integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
905 stars 746 forks source link

[BUG]: 5.43 upgrade failing due to signoff issues #2077

Open mattklein123 opened 10 months ago

mattklein123 commented 10 months ago

Expected Behavior

Just got the 5.43 upgrade and I'm seeing failures like:

Error: PATCH https://api.github.com/repos/***: 422 Commit signoff is enforced by the organization and cannot be disabled []

I assume this is somehow due to https://github.com/integrations/terraform-provider-github/pull/2007/files. I've tried manually adding web_commit_signoff_required but this still seems to fail:

 # module.***.github_repository.repo will be updated in-place
  ~ resource "github_repository" "repo" {
      + web_commit_signoff_required = true
        # (35 unchanged attributes hidden)
    }

Is this related to something else or is there something else I should be doing here? Thank you.

Actual Behavior

Doesn't fail / backwards compatible.

Terraform Version

1.2.6, 5.43

Affected Resource(s)

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

No response

Code of Conduct

nnellanspdl commented 10 months ago

I know it's not a fix, but ignoring that field might be a workaround for now?

resource "github_repository" "repo" {
  lifecycle {
    ignore_changes = [
      web_commit_signoff_required
    ]
  }
}
nyanhp commented 9 months ago

I know it's not a fix, but ignoring that field might be a workaround for now?

resource "github_repository" "repo" {
  lifecycle {
    ignore_changes = [
      web_commit_signoff_required
    ]
  }
}

Unfortunately, this does not seem to help either. The error also occurs on a completely new deployment, as soon as the repository resource is applied.

brunooon commented 9 months ago

I know it's not a fix, but ignoring that field might be a workaround for now?

resource "github_repository" "repo" {
  lifecycle {
    ignore_changes = [
      web_commit_signoff_required
    ]
  }
}

Unfortunately, this does not seem to help either. The error also occurs on a completely new deployment, as soon as the repository resource is applied.

I was still facing the same issue, so I had to remove the commit signoff from the org and I'm setting to true only on the repos now, its working so far.

mrclrchtr commented 8 months ago

Same here... 😕 with version 6.0.0 Only for initial creation I think.

mvarchdev commented 7 months ago

Same here, using pulumi/github

mvarchdev commented 7 months ago

@iwahbe FYI

bzarboni1 commented 7 months ago

We've been running into this issue today as well, but I haven't changed the web_commit_signoff_required parameter at all (I'm updating the setting of advanced_security to true). I am, however, getting the 422 error listed by the OP.

I've forked the provider, and thrown a debugger on it, and have been able to tell the following:

I've modified the provider locally, with a bit of a hack, that sets the web_commit_signoff_required to Nil (if the setting wasn't changed), before we send the request to the github module/API. It resolved the issue for us.

        // There's a bug in the GitHub 2022-11-28 version, that throws a 422 error
    // whenever the `web_commit_signoff_required` is set to true, even when it 
    // is already true.
    if !d.HasChange("web_commit_signoff_required") && d.Get("web_commit_signoff_required").(bool) {
        // remove the field from the request
        repoReq.WebCommitSignoffRequired = nil
    }

Inserted into: resource_github_repository.go:resourceGithubRepositoryUpdate:763

Unless the GitHub API is fixed (I'd say this is a bug on their end), maybe this could be the workaround.

SombreroElGringo commented 5 months ago

I'm currently facing the same issue with the latest version 6.2.1

Edit: I was able to bypass this issue by downgrading to the version 5.37

rcroft-work commented 2 months ago

+1 Facing the same issue when creating new repository.

Disabling at org-level and applying on repo-level worked but annoying as need to do it on each and every repo (with potential to miss a repo).