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 import for github_team fails. #539

Closed
codezninja opened this issue Aug 27, 2020 · 3 comments
Closed

terraform import for github_team fails. #539

codezninja opened this issue Aug 27, 2020 · 3 comments

Comments

@codezninja
Copy link

codezninja commented Aug 27, 2020

Terraform Version

terraform 0.13.1
github provider 2.9.2

Affected Resource(s)

Please list the resources as a list, for example:

  • github_team

Terraform Configuration Files

resource "github_team" "team" {
  for_each = local.teams

  name = each.key
  description = each.value["description"]
  privacy = each.value["privacy"]
}

Debug Output

2020-08-26T20:27:46.803-0400 [DEBUG] plugin.terraform-provider-github_v2.9.2_x4: 2020/08/26 20:27:46 [DEBUG] Reading team: 435
2020-08-26T20:27:46.803-0400 [DEBUG] plugin.terraform-provider-github_v2.9.2_x4: 2020/08/26 20:27:46 [DEBUG] Github API Request Details:
2020-08-26T20:27:46.803-0400 [DEBUG] plugin.terraform-provider-github_v2.9.2_x4: ---[ REQUEST ]---------------------------------------
2020-08-26T20:27:46.803-0400 [DEBUG] plugin.terraform-provider-github_v2.9.2_x4: GET /api/v3/organizations/2510/team/435 HTTP/1.1

Expected Behavior

Terraform should import remote team succesfully

Actual Behavior

Fails to find resource

2020-08-26T20:27:46.973-0400 [DEBUG] plugin.terraform-provider-github_v2.9.2_x4: 2020/08/26 20:27:46 [WARN] Removing team 435 from state because it no longer exists in GitHub
2020/08/26 20:27:46 [ERROR] eval: *terraform.EvalImportStateVerify, err: Cannot import non-existent remote object: While attempting to import an existing object to github_team.team["Administrators"], the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is correct and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.
2020/08/26 20:27:46 [ERROR] eval: *terraform.EvalSequence, err: Cannot import non-existent remote object: While attempting to import an existing object to github_team.team["Administrators"], the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is correct and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.

Error: Cannot import non-existent remote object

Steps to Reproduce

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

  1. terraform import github_team.team1 435

Important Factoids

  • believe its a bug on how the team is fetched. Its pulling the org by id instead of name
    this GET /api/v3/organizations/2510/team/435 should be GET /api/v3/organizations/ORG_NAME/team/435
@codezninja codezninja changed the title terraform import for github_team failes. terraform import for github_team fails. Aug 27, 2020
@codezninja
Copy link
Author

codezninja commented Aug 27, 2020

After debugging through the code I believe its an issue with version of github enterprise api. I'm currently on https://developer.github.com/enterprise/2.20/v3 is there a way to figure out which version of the terraform provider maps to github api?

If I got back to v2.4.1. I'm able to import the resource succesfully

@codezninja
Copy link
Author

Looks like #404 might be my issue

@jcudit
Copy link
Contributor

jcudit commented Nov 25, 2020

Apologies for the state of enterprise deployment support in this provider. It is a known gap to close over time.

Reading up on the linked issue, it seems like v2.21.7 of GHES has good compatibility with this provider.

Contributors have also been able to signal compatibility via the CHANGELOG in the past. The project will continue to look out for documentation possibilities going forward to save time / avoid frustration.

Will close this one up, but please re-open if there is more to discuss.

@jcudit jcudit closed this as completed Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants