Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: cannot unmarshal object into Go struct field Protection.lock_branch of type bool after upgrade to v5.13.0 #1476

Closed
TheQueenIsDead opened this issue Jan 10, 2023 · 1 comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@TheQueenIsDead
Copy link
Contributor

Version

$ terraform version
Terraform v1.3.7
on linux_amd64
+ provider registry.terraform.io/integrations/github v5.13.0

Expected Behaviour

With Terraform config that could successfully execute a plan using module version v5.12.0.
I expect to be able to successfully execute a plan when upgrading to v5.13.0.

Actual Behaviour

I receive an error unmarshalling an existing branch protection

│ Error: json: cannot unmarshal object into Go struct field Protection.lock_branch of type bool
│ 
│   with module.repository["<repo_name>"].github_branch_protection_v3.branch_protection[0],
│   on .terraform/modules/repository/main.tf line 240, in resource "github_branch_protection_v3" "branch_protection":240: resource "github_branch_protection_v3" "branch_protection" {
│ 

Diagnosis

As alluded to in this comment, the module has recently updated go-github from 48.1.0 to 48.2.0 (#1425).

I'm assuming that the SDK adding support for the lock_branch property from the API response (added here), is causing the unmarshalling to fail, and this could perhaps be fixed by adding a lock_branch property to the branch protection state

@nickfloyd nickfloyd added Type: Bug Something isn't working as documented Status: Up for grabs Issues that are ready to be worked on by anyone labels Jan 13, 2023
@TheQueenIsDead
Copy link
Contributor Author

As @kfcampbell mentioned, this is resolved for me in the 5.14.0 release due to:

google/go-github#2612, fixed in google/go-github#2606, released here, and added to the project as part of #1473.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

2 participants