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

Error: Unexpected ID format (""), expected numerical ID. strconv.ParseInt: parsing "": invalid syntax #26923

Closed
pbharambe opened this issue Nov 15, 2020 · 2 comments

Comments

@pbharambe
Copy link

Getting "strconv.ParseInt: parsing" error while destroying exiting team membership in terraform apply.

Terraform Version

Terraform v0.12.24

Terraform Configuration Files

repositories.tf

variable "github_token" {}

provider "github" {
  version = "~> 2.2.1"

  base_url     = "https://api.github.com/"
  organization = "pankajlab"
  token        = "${var.github_token}"
}

/***********************************************************************************************************************
 * TEAMS
 */
resource "github_team" "app-developers" {
  name        = "app-developers"
  description = "All app Developers."
  privacy     = "closed"
}

resource "github_team" "admin" {
  name    = "admin"
  privacy = "closed"
}

resource "github_team_membership" "pbharambe" {
  team_id  = "${github_team.admin.id}"
  username = "pbharambe"
  role     = "maintainer"
}

locals {
  app_team_ids = [
    "${github_team.app-developers.id}"
  ]
}

/***********************************************************************************************************************
 * REPOSITORIES
 */

module "cf-environments" {
  source = "./modules/github"

  repository_name = "cf-environments"
  description     = "Configurations defining Cloud Foundry environments along with the tools for managing them."

  branches_to_protect = ["master"]

  admin_team_id = "${github_team.admin.id}"
  team_ids      = "${local.app_team_ids}"
}

module "database-management" {
  source = "./modules/github"

  repository_name = "database-management"

  branches_to_protect = ["master"]

  admin_team_id = "${github_team.admin.id}"
  team_ids      = "${local.app_team_ids}"
}
------------------------------------------------------------------------------------
main.tf

variable "repository_name" {}

variable "auto_init" {
  default = true
}

variable "description" {
  default = ""
}

variable "private" {
  default = false
}

variable "has_downloads" {
  default = true
}

variable "has_issues" {
  default = true
}

variable "has_wiki" {
  default = true
}

variable "allow_merge_commit" {
  default = false
}

variable "allow_squash_merge" {
  default = true
}

variable "allow_rebase_merge" {
  default = false
}

variable "branches_to_protect" {
  type    = "list"
  default = ["master"]
}

variable "admin_team_id" {
  default = ""
}

variable "team_ids" {
  type    = "list"
  default = []
}

variable "enforce_admins" {
  default = true
}

resource "github_repository" "main" {
  name        = "${var.repository_name}"
  description = "${var.description}"

  private = "${var.private}"

  has_downloads = "${var.has_downloads}"
  has_issues    = "${var.has_issues}"
  has_wiki      = "${var.has_wiki}"

  allow_merge_commit = "${var.allow_merge_commit}"
  allow_squash_merge = "${var.allow_squash_merge}"
  allow_rebase_merge = "${var.allow_rebase_merge}"

  auto_init = "${var.auto_init}"

  lifecycle {
    prevent_destroy = true
  }
}

resource "github_team_repository" "admin" {
  team_id    = "${var.admin_team_id}"
  repository = "${github_repository.main.name}"
  permission = "admin"
}

resource "github_team_repository" "main" {
  count = "${length(var.team_ids)}"

  team_id    = "${var.team_ids[count.index]}"
  repository = "${github_repository.main.name}"
  permission = "push"
}

resource "github_branch_protection" "main" {
  count = "${length(var.branches_to_protect)}"

  repository = "${github_repository.main.name}"
  branch     = "${var.branches_to_protect[count.index]}"

  required_pull_request_reviews {
    dismiss_stale_reviews = true
    dismissal_teams       = ["${var.admin_team_id}"]
  }

  enforce_admins = false
}


Expected Behavior

The membership should have removed first and then the user from the organization.

Actual Behavior

github_team_membership.pbharambe: Destroying... [id=4275642:pbharambe]

Error: Unexpected ID format (""), expected numerical ID. strconv.ParseInt: parsing "": invalid syntax

Steps to Reproduce

  1. terraform init
  2. terraform plan
  3. terraform apply
@ghost
Copy link

ghost commented Nov 16, 2020

This issue has been automatically migrated to terraform-providers/terraform-provider-github#608 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to terraform-providers/terraform-provider-github#608.

@ghost ghost closed this as completed Nov 16, 2020
@ghost
Copy link

ghost commented Dec 17, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants