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

can not upgrade v3.1.0 above #634

Closed
3 tasks
yuzujoe opened this issue Dec 21, 2020 · 7 comments
Closed
3 tasks

can not upgrade v3.1.0 above #634

yuzujoe opened this issue Dec 21, 2020 · 7 comments
Labels
r/branch_protection Status: Stale Used by stalebot to clean house Type: Bug Something isn't working as documented

Comments

@yuzujoe
Copy link

yuzujoe commented Dec 21, 2020

When I try to upgrade the Branch protection resources to 3.1.0 or higher, the plan fails with an error.

Terraform Version

$ terraform version
Terraform v0.13.5
provider registry.terraform.io/hashicorp/github v3.1.0

Affected Resource(s)

"github_branch_protection"

Terraform Configuration Files

resource "github_branch_protection" "server" {
  for_each = toset(local.server)

  repository     = each.value
  branch         = "master"
  enforce_admins = "true"

  required_status_checks {
    strict = "true"
  }
}

Debug Output

terraform plan

Error: Missing required argument

  on server.tf line 1, in resource "github_branch_protection" "server":
   1: resource "github_branch_protection" "server" {

The argument "repository_id" is required, but no definition was found.


Error: Missing required argument

  on server.tf line 1, in resource "github_branch_protection" "server":
   1: resource "github_branch_protection" "server" {

The argument "pattern" is required, but no definition was found.


Error: Unsupported argument

  on server.tf line 4, in resource "github_branch_protection" "server":
   4:   repository     = each.value

An argument named "repository" is not expected here.


Error: Unsupported argument

  on server.tf line 5, in resource "github_branch_protection" "server":
   5:   branch         = "master"

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

  • Exactly what the plan goes through.

Actual Behavior

  • error occurred

Important Factoids

  • It worked fine up to 3.0.0.

References

@jcudit
Copy link
Contributor

jcudit commented Dec 23, 2020

This is likely due to breaking changes introduced in v3.1.0 and later rebranded as v4.0.0. See here for more details on the breaking changes.

@jcudit jcudit closed this as completed Dec 23, 2020
@yuzujoe
Copy link
Author

yuzujoe commented Dec 24, 2020

@jcudit
Would this be a forceful rewrite of the state?
a few changes have come in.

@jcudit jcudit reopened this Jan 4, 2021
@jcudit
Copy link
Contributor

jcudit commented Jan 4, 2021

@yuzujoe I have not tested this upgrade path but can get this tracked to test out in the future. 🤔 you may have success with the following sequence:

  • move all github_branch_protection resources to a backup state file
  • upgrade the provider and re-write the github_branch_protection blocks with the latest arguments
  • try importing the moved resources
  • if ☝🏾 failed, downgrade the provider and move the backup resources back into the original state file

If the upgrade still fails, let us know. This is something that will have to be ironed out when https://github.com/terraform-providers/terraform-provider-github/pull/642 ships as well.

@jcudit jcudit added Type: Bug Something isn't working as documented r/branch_protection labels Jan 14, 2021
@yuzujoe
Copy link
Author

yuzujoe commented Jan 19, 2021

@jcudit Hi

I tried upgrade github provider.
I was able to get the plan through, but there are some problems such as very slow plan speed.

Also, why did they change from repository to repository_id?

I'm not sure what the benefit of this is.

@jcudit
Copy link
Contributor

jcudit commented Jan 19, 2021

The change to repository_id is documented here, but in short it was made to support switching to GraphQL-based queries.

It sounds like you may have better results with the new github_branch_protection_v3 resource instead of github_branch_protection. See here for further details.

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Dec 7, 2022
@github-actions github-actions bot removed the Status: Stale Used by stalebot to clean house label Dec 8, 2022
Copy link

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Apr 23, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r/branch_protection Status: Stale Used by stalebot to clean house Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

4 participants