integrations / terraform-provider-github

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

cannot upgrade to above 3.1.0 #621

Closed kzw closed 4 months ago

kzw commented 3 years ago

We have many resources managed with terraform 0.12.29 and provider 2.9.2.

Now we want to upgrade to at least 4.0.1 and even 4.1.0. But anything above 3.1.0 breaks terraform plan with error message. I can reproduce this to one specific branch_protection resource which errors with the message

Error: Could not resolve to a node with the global id of 'liveshare-custom-domain-pipeline'

I have pruned the code and state so that only 2 resources remain and I am getting this error.

No error when I upgraded to just 3.1.0

Terraform Version

Terraform v0.12.29
+ provider.aws v3.0.0
+ provider.github v4.1.0

Your version of Terraform is out of date! The latest version
is 0.14.0. You can update by downloading from https://www.terraform.io/downloads.html

Also tried with terraform version 0.13.5 to no avail

Affected Resource(s)

github_branch_protection.liveshare_custom_domain_pipeline

Terraform Configuration Files


resource "github_branch_protection" "liveshare_custom_domain_pipeline" {
  repository_id  = github_repository.liveshare_custom_domain_pipeline.node_id
  pattern        = "master"
  enforce_admins = true

  required_pull_request_reviews {
    dismiss_stale_reviews      = true
    require_code_owner_reviews = false
  }

  required_status_checks {
    strict = true
  }

  push_restrictions = [data.github_team.devops.slug, data.github_team.operations.slug]
}
data "github_team" "devops" {
  slug = "devops"
}

data "github_team" "operations" {
  slug = "operations"
}
terraform {
  required_version = "= 0.12.29"
}

provider "aws" {
  region  = "us-east-1"
  version = "= 3.0.0"
}

# Configure the GitHub Provider
provider "github" {
  organization = var.github_organization
  token        = var.github_token
  version      = "= 4.1.0"
}
resource "github_repository" "liveshare_custom_domain_pipeline" {
  name        = "liveshare-custom-domain-pipeline"
  description = ""

  allow_merge_commit = false
  allow_rebase_merge = false

  visibility = "private"

  lifecycle {
    prevent_destroy = true
  }
}
variable "github_organization" {
  default = "seismic"
}

variable "github_token" {
  default = ""
}

Debug Output

available upon request

Panic Output

Expected Behavior

No error.

Actual Behavior

Error.

Steps to Reproduce

  1. terraform plan

Important Factoids

No error for provider 3.1.0. I also get the above error when I use target on this resource

terraform  plan -target github_branch_protection.liveshare_custom_domain_pipeline
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.github_team.devops: Refreshing state...
data.github_team.operations: Refreshing state...
github_repository.liveshare_custom_domain_pipeline: Refreshing state... [id=liveshare-custom-domain-pipeline]

Error: Could not resolve to a node with the global id of 'liveshare-custom-domain-pipeline'

Before pruning code and state, I get no error when I plan with target on other resources.

I also get the following error on state show


terraform state show github_branch_protection.liveshare_custom_domain_pipeline
unsupported attribute "branch"
# github_branch_protection.liveshare_custom_domain_pipeline:
resource "github_branch_protection" "liveshare_custom_domain_pipeline" {

I tried the same terraform state show with other resources and I get similar error.

Polygens commented 3 years ago

610 Our team was experiencing a similar issue

yuzujoe commented 3 years ago

https://github.com/terraform-providers/terraform-provider-github/issues/634 I'm suffering from a similar problem.

alk-rniveau commented 3 years ago

We have the same here:

terraform import 'module.scar.module.review.github_branch_protection.master-approved[0]' scar:master                                     git:(master) ✗

module.scar.module.review.github_branch_protection.master-approved[0]: Importing from ID "scar:master"...

Error: Could not resolve to a node with the global id of 'scar'
majormoses commented 3 years ago

Are you able to replicate this with newly created resources or only existing? I had a number of these issues that only seemed to happen for a subset of the existing resources. Rather than importing/moving any resources I had to opt to delete and recreate the branch protections. Not sure if your mileage will vary.

great-qwerty commented 3 years ago

@majormoses the same happens with newly created resources as well:

module.github_repository.github_branch_protection.main: Creating...
  enforce_admins:                                                  "" => "false"
  pattern:                                                         "" => "master"
  repository_id:                                                   "" => "test-repo"
  require_signed_commits:                                          "" => "false"
  required_pull_request_reviews.#:                                 "" => "1"
  required_pull_request_reviews.0.required_approving_review_count: "" => "1"
  required_status_checks.#:                                        "" => "1"
  required_status_checks.0.contexts.#:                             "" => "2"
  required_status_checks.0.contexts.1584824872:                    "" => "ci/circleci"
  required_status_checks.0.contexts.2007057319:                    "" => "ci/jenkins"
  required_status_checks.0.strict:                                 "" => "true"

Error: Error applying plan:

1 error(s) occurred:

* module.github_repository.github_branch_protection.main: 1 error(s) occurred:

* github_branch_protection.main: Could not resolve to a node with the global id of 'test-repo'
5obol commented 3 years ago

We suffer same problem, our github provider version is 4.1.0 and error we're seeing:

Error: Error applying plan:

1 error(s) occurred:

Terraform does not automatically rollback in the face of errors. Instead, your Terraform state file has been partially updated with any resources that successfully completed. Please address the error above and apply again to incrementally change your infrastructure.

kchristensen commented 3 years ago

We're in the same boat. Currently on 3.1.0, but trying to go to anything newer (including the new 4.3.2) when running a plan or trying to import anything, I get:

Instance module.github_repository-whatever.github_branch_protection.additional_rules["master"]
data could not be decoded from the state: unsupported attribute "branch".

Trying to run a state show, I see the same thing.

❯ _ENV=STUFF tf state show 'module.github_repository-whatever.github_branch_protection.additional_rules["master"]'

<SNIP>

Running command: terraform state show module.github_repository-whatever.github_branch_protection.additional_rules["master"]
unsupported attribute "branch"

# module.github_repository-whatever.github_branch_protection.additional_rules["master"]:
resource "github_branch_protection" "additional_rules" {

Looking in the actual state, there is indeed a branch attribute:

      "instances": [
        {
          "index_key": "master",
          "schema_version": 0,
          "attributes": {
            "branch": "master",
            "enforce_admins": false,
            "etag": "W/\"REDACTED\"",
            "id": "whatever:master",
            "repository": "whatever",
            "require_signed_commits": false,
            "required_pull_request_reviews": [
              {
                "dismiss_stale_reviews": false,
                "dismissal_teams": [],
                "dismissal_users": [],
                "include_admins": false,
                "require_code_owner_reviews": true,
                "required_approving_review_count": 1
              }
            ],
            "required_status_checks": [
              {
                "contexts": [
                  "continuous-integration/jenkins/pr-merge"
                ],
                "include_admins": false,
                "strict": false
              }
            ],
            "restrictions": []
          },
          "sensitive_attributes": [],
          "private": "REDACTED",
          "dependencies": [
            "module.github_repository-whatever.github_repository.repository"
          ]
        }
     ]

What's the path forward here? I have hundreds of repositories, I really don't want to have to edit the state manually and remove this branch attribute if it has been deprecated. There's hundreds and hundreds of references that would need to be updated.

jcudit commented 3 years ago

🤔 seems like we could introduce a new upgrader to https://github.com/integrations/terraform-provider-github/blob/master/github/migrate_github_branch_protection.go. We may also be able to re-add a computed branch attribute that does nothing but facilitate rolling forward. Open to either option, but feel we may need some back and forth to test that it all works correctly.

kchristensen commented 3 years ago

I'm in a position where we upgraded to Terraform 14, and the Github provider handoff meant I can't continue using 3.1.0, but I can't do anything on versions newer than 3.1.0 so I'm stuck manually making repository changes and having to reconcile them at some point when this gets fixed.

Some kind of upgrade process is much needed because we're managing 2-3 branch protection rules * hundreds of repositories and there's no real path forward for us.

kchristensen commented 3 years ago

Anyone have ANY workarounds for this? At this point I am willing to spend a couple hours massaging our state file manually if need be to get back to the point where I can interact with our Github organization at all.

majormoses commented 3 years ago

We finally saw this on a new resource:

module.my-repo.github_branch_protection.default[0]: Creating...

Error: Could not resolve to a node with the global id of '1111111'

  on ../../../../modules/repository/branch_default.tf line 11, in resource "github_branch_protection" "default":
  11: resource "github_branch_protection" "default" {

It's worth noting that we are using repository_id = github_repository.repo.node_id rather than the name, which as I understand it is desirable to eventually support repositories being safely renamed.

I agree it's not about old vs new resources even if that's where I saw it first. It does seem quite "random" but then consistently repeatable. I don't know much about graphql but I will try to see if I can find some time next week at work to use a local proxy to capture the API requests so we can see the full (redacted) payloads. I think the likely causes are an issue with the query we are writing or an infrastructure issue with Github that is missing some kind of required "index" on certain nodes is the graph.

majormoses commented 3 years ago

This actually seems related: https://github.blog/2021-02-10-new-global-id-format-coming-to-graphql/ I have opened a support ticket to confirm this might be and if so get some information on when it actually started rolling out.

jcudit commented 3 years ago

😬 seems like we'd need to account for old and new formats, thanks for linking https://github.blog/2021-02-10-new-global-id-format-coming-to-graphql/.

Capturing the failure with a local proxy or leveraging TF_LOG=DEBUG (or TRACE) are good next steps here to get more information. Just to confirm, @majormoses are you experiencing this with version 3.1.0?

My next steps here are to get a test org provisioned using v3.1.0 and then iterate on a state upgrader this week. It seems like only github_branch_protection is blocking upgrades, but if anyone else can point out other resources to include, please let me know. Will keep an eye out for the different format as well and hopefully come up with separate fixes to what seems to be two intertwined bugs.

jcudit commented 3 years ago

😕 I was able to upgrade from v3.1.0 to v4.0.1 with this configuration and create new resources / modify existing ones:

$ terraform version
Terraform v0.14.5
+ provider registry.terraform.io/hashicorp/github v4.0.1
resource "github_repository" "terraformed" {
  name        = "terraformed"
  description = "A repository created by Terraform"
}

resource "github_branch_protection" "terraformed" {
  repository_id  = github_repository.terraformed.node_id
  pattern        = "main"
  enforce_admins = true

  required_pull_request_reviews {
    dismiss_stale_reviews      = true
    require_code_owner_reviews = false
  }

  required_status_checks {
    strict = true
  }

  push_restrictions = [data.github_team.test.node_id]
}

data "github_team" "test" {
  slug = "test-first"
}

I did see similar error messaging to what has been posted in this thread when passing a slug into the push_restrictions array:

push_restrictions = [data.github_team.test.slug]

Error: Could not resolve to a node with the global id of 'test-first'

  on main.tf line 6, in resource "github_branch_protection" "terraformed":
   6: resource "github_branch_protection" "terraformed" {

Any chance switching to .node_id helps anyone else's upgrade?

kchristensen commented 3 years ago

I've been using .node_id in my branch protection rules for some time now but I still run into the Instance module.github_repository-whatever.github_branch_protection.additional_rules["master"] data could not be decoded from the state: unsupported attribute "branch". when trying to move from 3.1.0 to current.

majormoses commented 3 years ago

seems like we'd need to account for old and new formats, thanks for linking https://github.blog/2021-02-10-new-global-id-format-coming-to-graphql/.

Capturing the failure with a local proxy or leveraging TF_LOG=DEBUG (or TRACE) are good next steps here to get more information. Just to confirm, @majormoses are you experiencing this with version 3.1.0?

My next steps here are to get a test org provisioned using v3.1.0 and then iterate on a state upgrader this week. It seems like only github_branch_protection is blocking upgrades, but if anyone else can point out other resources to include, please let me know. Will keep an eye out for the different format as well and hopefully come up with separate fixes to what seems to be two intertwined bugs.

Sorry I have not had time yet to dig further I am having these issues in some places but not others and we are on the latest version released as of last I commented. I will try to do some testing but I suspect based on some other issues I have seen that it might be another form of those bas64 decoding issues. The one repo I am currently able to replicate with is has a total of 5 chars (hs-ops) and I think that is somehow relevant but I will try to confirm that when I can.

majormoses commented 3 years ago

I tried pulling in 4.5 but I am not seeing any more actual debug context sadly. I will have to use the verbosity settings and/or proxy to try to dig more.

majormoses commented 3 years ago
Here is the `REDACTED` snippet from running with `TF_LOG=DEBUG` ```terraform 2021/02/26 12:30:34 [WARN] Provider "registry.terraform.io/integrations/github" produced an unexpected new value for module.-repo-hs-ops.github_team_repository.admins, but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations: - .etag: was cty.StringVal("W/\"dc646b011149d407c8cacc18adb63a748f769b181e1ea6f9a72088f28afc2b49\""), but now cty.StringVal("W/\"5c032f8ad7fe3529caaa664cb70d0b37279f7f12e0938e0e1fc4426fea917b0a\"") module.-repo-hs-ops.github_team_repository.admins: Modifications complete after 1s [id=:hs-ops] 2021/02/26 12:30:34 [WARN] Provider "registry.terraform.io/integrations/github" produced an invalid plan for module.-repo-hs-ops.github_branch_protection.default[0], but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations: - .require_signed_commits: planned value cty.False does not match config value cty.NullVal(cty.Bool) - .allows_deletions: planned value cty.False does not match config value cty.NullVal(cty.Bool) - .allows_force_pushes: planned value cty.False does not match config value cty.NullVal(cty.Bool) - .required_pull_request_reviews[0].dismissal_restrictions: planned value cty.NullVal(cty.Set(cty.String)) does not match config value cty.SetValEmpty(cty.String) - .required_status_checks[0].contexts: planned value cty.NullVal(cty.Set(cty.String)) does not match config value cty.SetValEmpty(cty.String) module.-repo-hs-ops.github_branch_protection.default[0]: Creating... 2021/02/26 12:30:34 [DEBUG] EvalApply: ProviderMeta config value set 2021/02/26 12:30:34 [DEBUG] module.-repo-hs-ops.github_branch_protection.default[0]: applying the planned Create change 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:34 [DEBUG] Github API Request Details: 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ---[ REQUEST ]--------------------------------------- 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: POST /graphql HTTP/1.1 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Host: api.github.com 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: User-Agent: Go-http-client/1.1 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Length: 99 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Type: application/json 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Accept-Encoding: gzip 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: { 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "query": "query($id:ID!){node(id:$id){id}}", 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "variables": { 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "id": "MDEwOlJlcG9zaXRvcnkzMzcxNDE2MDI=" 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ----------------------------------------------------- 2021-02-26T12:30:34.500-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:34 [TRACE] Acquiring lock for GitHub API request (%!q()) 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:34 [TRACE] Releasing lock for GitHub API request (%!q()) 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:34 [DEBUG] Github API Response Details: 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ---[ RESPONSE ]-------------------------------------- 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: HTTP/2.0 200 OK 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Access-Control-Allow-Origin: * 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Cache-Control: no-cache 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Security-Policy: default-src 'none' 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Type: application/json; charset=utf-8 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Date: Fri, 26 Feb 2021 20:30:34 GMT 2021-02-26T12:30:34.715-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Server: GitHub.com 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Strict-Transport-Security: max-age=31536000; includeSubdomains; preload 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Vary: Accept-Encoding, Accept, X-Requested-With 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Accepted-Oauth-Scopes: repo 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Content-Type-Options: nosniff 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Frame-Options: deny 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Github-Media-Type: github.v4; format=json 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Github-Request-Id: 8534:26DB:86056:9B3EC:60395A6A 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Oauth-Scopes: admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion, write:packages 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Limit: 5000 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Remaining: 4995 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Reset: 1614374726 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Used: 5 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Xss-Protection: 1; mode=block 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: { 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "data": { 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "node": { 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "id": "MDEwOlJlcG9zaXRvcnkzMzcxNDE2MDI=" 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.716-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ----------------------------------------------------- 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:34 [DEBUG] Github API Request Details: 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ---[ REQUEST ]--------------------------------------- 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: POST /graphql HTTP/1.1 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Host: api.github.com 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: User-Agent: Go-http-client/1.1 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Length: 672 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Type: application/json 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Accept-Encoding: gzip 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: { 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "query": "mutation($input:CreateBranchProtectionRuleInput!){createBranchProtectionRule(input: $input){branchProtectionRule{id}}}", 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "variables": { 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "input": { 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "repositoryId": "MDEwOlJlcG9zaXRvcnkzMzcxNDE2MDI=", 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "pattern": "master", 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "requiresApprovingReviews": true, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "requiredApprovingReviewCount": 1, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "requiresCommitSignatures": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "allowsForcePushes": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "allowsDeletions": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "isAdminEnforced": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "requiresStatusChecks": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "requiresStrictStatusChecks": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "requiresCodeOwnerReviews": true, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "dismissesStaleReviews": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "restrictsReviewDismissals": false, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "reviewDismissalActorIds": null, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "restrictsPushes": true, 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "pushActorIds": [ 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "" 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ], 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "requiredStatusCheckContexts": null 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ----------------------------------------------------- 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:34 [TRACE] Acquiring lock for GitHub API request (%!q()) 2021-02-26T12:30:34.717-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:34 [DEBUG] Sleeping 1s between write operations 2021-02-26T12:30:35.955-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:35 [TRACE] Releasing lock for GitHub API request (%!q()) 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021/02/26 12:30:35 [DEBUG] Github API Response Details: 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ---[ RESPONSE ]-------------------------------------- 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: HTTP/2.0 200 OK 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Access-Control-Allow-Origin: * 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Cache-Control: no-cache 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Security-Policy: default-src 'none' 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Content-Type: application/json; charset=utf-8 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Date: Fri, 26 Feb 2021 20:30:35 GMT 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Server: GitHub.com 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Strict-Transport-Security: max-age=31536000; includeSubdomains; preload 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: Vary: Accept-Encoding, Accept, X-Requested-With 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Accepted-Oauth-Scopes: repo 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Content-Type-Options: nosniff 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Frame-Options: deny 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Github-Media-Type: github.v4; format=json 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Github-Request-Id: 8534:26DB:86077:9B415:60395A6A 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Oauth-Scopes: admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion, write:packages 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Limit: 5000 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Remaining: 4994 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Reset: 1614374726 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Ratelimit-Used: 6 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: X-Xss-Protection: 1; mode=block 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: { 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "data": { 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "createBranchProtectionRule": null 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: }, 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "errors": [ 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: { 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "type": "NOT_FOUND", 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "path": [ 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "createBranchProtectionRule" 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ], 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "locations": [ 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: { 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "line": 1, 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "column": 51 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ], 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: "message": "Could not resolve to a node with the global id of ''" 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ] 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: } 2021-02-26T12:30:35.956-0800 [DEBUG] plugin.terraform-provider-github_v4.5.0: ----------------------------------------------------- 2021/02/26 12:30:35 [DEBUG] module.-repo-hs-ops.github_branch_protection.default[0]: apply errored, but we're indicating that via the Error pointer rather than returning it: Could not resolve to a node with the global id of '' 2021/02/26 12:30:35 [ERROR] eval: *terraform.EvalApplyPost, err: Could not resolve to a node with the global id of '' 2021/02/26 12:30:35 [ERROR] eval: *terraform.EvalSequence, err: Could not resolve to a node with the global id of '' ```
majormoses commented 3 years ago

@jcudit any chance you can DM me and we can setup a debugging session to hack on this? This is getting more dangerous for my org, it's cropping up in more places than I realized. If I don't get a resolution shortly we are gonna have to do something like switching back to the non gql endpoint which will be very painful as we are using features that are not yet supported on rest. I have also committed some time from some devs on my team to try digging into it as well.

majormoses commented 3 years ago

@jcudit I have some great news! I am still running through the number of ones, so far all the issues are when we are specifying id rather than node_id. If we know the provider resource requires a node_id and not an id I think we should build some validation into it because this is a footgun that wasted a ton of time and the error messages were really not helpful. We had to rely on using a proxy (burp) to capture the requests.

jcudit commented 3 years ago

Agreed, this is one of the more painful issues that have come up as of late. Glad to see we may have identified a root cause and am open to adding validation to close this out so others do not need to experience this friction.

github-actions[bot] commented 1 year ago

👋 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[bot] commented 5 months ago

👋 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!