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

Terraform refresh followed by terraform plan claimed repo needed to be created from scratch. #630

Closed
mallyvai opened this issue Dec 11, 2020 · 2 comments
Labels
r/repository Status: Stale Used by stalebot to clean house Type: Bug Something isn't working as documented

Comments

@mallyvai
Copy link

Terraform Version

terraform -v
Terraform v0.14.2

  • provider registry.terraform.io/hashicorp/github v3.1.0

Affected Resource(s)

Please list the resources as a list, for example:

  • github_repository

Terraform Configuration Files

resource "github_repository" "ops-kube-synthetic" {
  name        = "ops-kube-synthetic"
  description = lookup(var.repo_monolith.ops-kube-synthetic, "description", null)

  private = true

  allow_merge_commit     = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "allow_merge_commit", false)
  allow_rebase_merge     = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "allow_rebase_merge", false)
  allow_squash_merge     = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "allow_squash_merge", true)
  archived               = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "archived", false)
  default_branch         = lookup(var.repo_monolith, "ops-kube-synthetic", {})["default_branch"]
  delete_branch_on_merge = true
  has_downloads          = false
  has_issues             = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "has_issues", false)
  has_projects           = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "has_projects", false)
  has_wiki               = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "has_wiki", false)
  vulnerability_alerts   = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "vulnerability_alerts", false)

  // Used by the new repo boilerplate. Adding a license file creates a master branch so we can assign branch protection to it.
  license_template = lookup(lookup(var.repo_monolith, "ops-kube-synthetic", {}), "license_template", null)
}

Debug Output

Please provide a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Expected Behavior

What should have happened?

Actual Behavior

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

  • I needed to update the local Terraform variable to reflect the state of the world in Github.

  • I did terraform refresh -target=module.repos.github_repository.ops-kube-synthetic

  • The next time I did terraform plan -refresh=true it said the entire ops-kube-synthetic repository needed to be created from scratch.

  • I thought the state might have gotten corrupted so I did terraform import module.repos.github_repository.ops-kube-synthetic ops-kube-syntheticto unstick it.

  • Unfortunately I got Error: Cannot import non-existent remote object repeatedly

  • I confirmed repeatedly the Github repository did in fact exist.

  • I eventually manually fired up my Python3 terminal, instantiated a Github client with PyGithub, manually iterated over the set of repos to confirm the ops-kube-synthetic repo existed (it did).

  • I hit the up arrow on my terminal and re-ran the exact same import command

  • It worked!

  • The subsequent plan worked.

I suspect the Github API is to blame here but am unsure. This has happened just twice in the past three months, but it's incredibly annoying when it does. Advice would be appreciated.

Important Factoids

Is there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

@jcudit jcudit added Type: Bug Something isn't working as documented r/repository labels Dec 23, 2020
@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/repository 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