Skip to content

vulnerability-alerts 404 #716

Closed as not planned
Closed as not planned

Description

@czerasz

Terraform Version

$ terraform -v
Terraform v0.14.5
+ provider registry.terraform.io/integrations/github v4.5.0

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

Affected Resource(s)

  • github_repository

Terraform Configuration Files

../../modules/tf-repo/main.tf (pseudo code):

resource "github_repository" "this" {
  name        = var.name
  description = var.description

  ...
  vulnerability_alerts = null
}

.terraform.lock.hcl:

# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.

provider "registry.terraform.io/integrations/github" {
  version     = "4.5.0"
  constraints = "4.5.0"
  hashes = [
    "h1:KjMtn8N07rakB/oAwEFlmDd6YhJ5fentdjpF7A0fB3c=",
    "zh:22cb80695782a750ab8dd61357ed92a3ec3260b3cad15b3ed5cbb5371d1190eb",
    "zh:290b3d2b50df075835ff5dba2d02bf834576c9bb20555f715863c68e5ba2b482",
    "zh:31a0f119c5f384771706ddfb89f51c6a66ede1eab0091b19b39de5686c6189d3",
    "zh:393d3f4010c564aa0828082ec64ca014122cbb798fa28a2219d457e37378e300",
    "zh:4e278b74977c7b2eb5805ad549692970fd06546bf92c44d40991d73bc6107221",
    "zh:5762e3b7b23ae10537054513aadcc4ac6abc30a5e38464d15267510564e2ebb4",
    "zh:6fbf45fdb7c8246caccbf2988f7fa0a20a8c8a7bb660a9740d0f5345da5d024f",
    "zh:7f920eac133683763806ecafca2ac8916883368157ad5d1fef4266383ae5170b",
    "zh:c4d812f681f8b842c709deca79b44965a7688da96a1a0437c1d605135d9ea510",
    "zh:c928cb0ef5f2cae8e3e2c4253275ba9708003f768eed878debf7addd38127297",
    "zh:ce4064e833a4d26a7b9d46e438484a9fd1e28f15f3fc7b64b8cd6d39970a875e",
  ]
}

Debug Output

Panic Output

Expected Behavior

If the GHE instance doesn't support vulnerability-alerts end-point and vulnerability_alerts = null or vulnerability_alerts = false then the provider should not panic when 404 is returned by the API.

Actual Behavior

  • repository got created
  • error thrown
    Error: DELETE https://<BASE URL>.io/api/v3/repos/<ORG NAME>/<REPO NAME>/vulnerability-alerts: 404 Not Found []
    
      on ../../modules/tf-repo/main.tf line 1, in resource "github_repository" "this":
      1: resource "github_repository" "this" {
    
  • other resources from the module were not created

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

References

Activity

  1. czerasz commented on Mar 2, 2021

    @czerasz
    Author

    Workaround after failed apply:

    • remove github_repository resource from state:

      terraform state rm 'module.this["<REPO NAME>"].github_repository.this'
    • import github_repository resource:

      terraform import 'module.this["<REPO NAME>"].github_repository.this' '<REPO NAME>'
      
  2. added
    Type: Bug
    on Mar 8, 2021
  3. alxzndr commented on Mar 14, 2021

    @alxzndr

    I have the same issue. Thanks for posting a workaround.
    edit: workaround is not working for me, i cannot import the repo (it does exist in github..)

  4. r-bennett commented on Mar 26, 2021

    @r-bennett

    This endpoint is actually documented as being available in GHES 2.22, but we ran into the same thing and have confirmed with GitHub support that this is an error in the documentation.

    Looks like this is probably means there's a missing test-case from the GHES compatibility tests from #404 as well. It's a slightly weird one in how it crops up as the defaults are different for public and private repos, but I believe running a refresh on a repository resource will always trigger it.

    #444 was the change which introduced this, so another workaround is to use 3.0.0 or earlier

  5. jeffeland commented on May 7, 2021

    @jeffeland

    The workaround to use the version 3.0.0 from the provider doesn't seem to be available anymore and even the most recent version of the github enterprise doesn't support this feature yet. Any plan for a fix?

  6. colltoaction commented on Jun 30, 2021

    @colltoaction

    Seeing the same behavior. Workaround worked:

    $ terraform state rm github_repository.<REPO NAME>
    $ terraform import github_repository.<REPO NAME> <REPO NAME>
    
  7. joshmyers commented on Jul 8, 2021

    @joshmyers

    This is a massive pain and not a great workaround. Any plans for fix?

  8. jeffyaw commented on Oct 3, 2021

    @jeffyaw

    this was the fix for me, similar to @colltoaction, but with the resource name instead of the repo name in the first 2 spots.

    $ terraform state rm github_repository.<RESOURCE_NAME>
    $ terraform import github_repository.<RESOURCE_NAME> <REPO NAME>
    
  9. github-actions commented on Dec 4, 2022

    @github-actions

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

  10. added
    Status: Stale
    on Dec 4, 2022
  11. removed
    Status: Stale
    on Dec 6, 2022
  12. Danielku15 commented on Aug 31, 2023

    @Danielku15
    Contributor

    this bug is quite a pain, it prevents proper creation of new repositories via terraform. The workarounds are merely a "recovery" measure not something that gets the provider running.

    In our case this also leads to subsequent errors. where autolink references are only partially created. Any references created before this error are there, any references created afterwards are reported as:

    404 Not Found []

  13. github-actions commented on May 28, 2024

    @github-actions

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

  14. added
    Status: Stale
    on May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleType: Buggithub_enterpriser/repository

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions