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

GraphQL global ID migration #991

Closed
shogo82148 opened this issue Nov 30, 2021 · 2 comments
Closed

GraphQL global ID migration #991

shogo82148 opened this issue Nov 30, 2021 · 2 comments
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Stale Used by stalebot to clean house Status: Up for grabs Issues that are ready to be worked on by anyone Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR

Comments

@shogo82148
Copy link
Contributor

GitHub announced that the users should migrate their service to the next IDs.

In my understand, we also should migrate our .tfstate files to the next IDs.
Because they contain GraphQL global IDs.

How do we migrate them?

Terraform Version

Terraform v1.0.11
on darwin_amd64
+ provider registry.terraform.io/hashicorp/github v4.1.0
+ provider registry.terraform.io/integrations/github v4.18.0

Affected Resource(s)

  • github_branch_protection
  • and maybe many other resources

Terraform Configuration Files

resource "github_repository" "github" {
  name                   = "github"
  description            = "Terraform template for fuller-inc organization"
  visibility             = "private"
  has_issues             = true
  has_wiki               = true
  delete_branch_on_merge = true
  topics                 = []
  archive_on_destroy     = true
  vulnerability_alerts   = true
}

resource "github_branch_protection" "github_main" {
  repository_id = github_repository.github.node_id
  pattern       = "main"

  required_status_checks {
    strict   = true
    contexts = ["plan"]
  }

  required_pull_request_reviews {
    dismiss_stale_reviews = true
  }
}

Important Factoids

For example, here is the state of my github_branch_protection resource:

$ terraform state show github_branch_protection.github_main
# github_branch_protection.github_main:
resource "github_branch_protection" "github_main" {
    allows_deletions        = false
    allows_force_pushes     = false
    enforce_admins          = false
    id                      = "MDIwOkJyYW5jaXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX="
    pattern                 = "main"
    push_restrictions       = []
    repository_id           = "MDEwOlJlcG9zaXXXXXXXXXXXXXXXXXX="
    require_signed_commits  = false
    required_linear_history = false

    required_pull_request_reviews {
        dismiss_stale_reviews           = true
        dismissal_restrictions          = []
        require_code_owner_reviews      = false
        required_approving_review_count = 1
        restrict_dismissals             = false
    }

    required_status_checks {
        contexts = [
            "plan",
        ]
        strict   = true
    }
}

id and repository_id are looks like GraphQL global IDs.

$ gh api graphql -H "X-Github-Next-Global-ID: 1" -f query='query { node(id: "MDIwOkJyYW5jaXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=") { id } }
{
  "data": {
    "node": {
      "id": "BPR_XXXXXXXXXXXXXXXX"
    }
  }
}
$ gh api graphql -H "X-Github-Next-Global-ID: 1" -f query='query { node(id: "MDEwOlJlcG9zaXXXXXXXXXXXXXXXXXX=") { id } }'
{
  "data": {
    "node": {
      "id": "R_XXXXXXXXXX"
    }
  }
}

References

@shogo82148
Copy link
Contributor Author

Updates: https://github.blog/changelog/2022-11-10-graphql-legacy-global-id-deprecation-message/

As part of the ongoing initiative to deprecate legacy global IDs, you will begin to see deprecation warnings for GraphQL node queries using the legacy ID format.

@nickfloyd nickfloyd added Status: Up for grabs Issues that are ready to be worked on by anyone Priority: Normal Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR labels Nov 15, 2022
@nickfloyd nickfloyd moved this to 🔥 Backlog in 🧰 Octokit Active Dec 5, 2022
@nickfloyd nickfloyd added the hacktoberfest Issues for participation in Hacktoberfest label Sep 20, 2023
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 Jun 19, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2024
@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Stale Used by stalebot to clean house Status: Up for grabs Issues that are ready to be worked on by anyone Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR
Projects
None yet
Development

No branches or pull requests

2 participants