terraform-provider-github
terraform-provider-github copied to clipboard
[BUG]: repo_id attribute not generated
Expected Behavior
The documentations attribute reference suggests an attribute name repo_id should be available.
However, non of our repos attributes contain this key.
Actual Behavior
All other attributes exist, but repo_id
does not.
Terraform Version
Terraform 0.13.7 integrations/github version 5.39.0
Affected Resource(s)
- github_repository
Terraform Configuration Files
No response
Steps to Reproduce
No response
Debug Output
No response
Panic Output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Hey @neilharris123 Thanks for reaching out. The following is where repo_id
is present:
- In the resourceGithubRepository schema
- In the dataSourceGithubRepository data source
- In the github_respoitory docs (as you pointed out)
For clarity, were you expecting to see it somewhere else as well? Have a look at this test that makes use of include_repo_id
as part of the query. Docs here. Let me know if that's what you were looking for.
Hey @neilharris123 Thanks for reaching out. The following is where
repo_id
is present:
- In the resourceGithubRepository schema
- In the dataSourceGithubRepository data source
- In the github_respoitory docs (as you pointed out)
For clarity, were you expecting to see it somewhere else as well? Have a look at this test that makes use of
include_repo_id
as part of the query. Docs here. Let me know if that's what you were looking for.
@nickfloyd ,the issue is with github_repository
data source (single repo data source, not multiple repo data source)
That said, I too run into a similar issue. When referencing data.github_repository.<name>.name
Terraform complains the related field is not set, implying name
returns null
:
variable "repositories" {
type = map(string)
}
data "github_team" "administrators" {
slug = "code-security"
}
data "github_repository" "owned" {
for_each = var.repositories
name = each.key
}
resource "github_team_repository" "maintainership" {
for_each = data.github_repository.owned
team_id = "@code-security"
repository = each.value.name
permission = "push"
}
yields:
│ Error: "repository": required field is not set
│
│ with module.repositories.github_team_repository.maintainership["my-repo"],
│ on modules/repositories/main.tf line 40, in resource "github_team_repository" "maintainership":
│ 40: resource "github_team_repository" "maintainership" {
│
╵
As there's no includ_repo_id
flag for the single repo data source, I'd say something's off in the read function?
Hey @neilharris123 Thanks for reaching out. The following is where
repo_id
is present:
- In the resourceGithubRepository schema
- In the dataSourceGithubRepository data source
- In the github_respoitory docs (as you pointed out)
For clarity, were you expecting to see it somewhere else as well? Have a look at this test that makes use of
include_repo_id
as part of the query. Docs here. Let me know if that's what you were looking for.@nickfloyd ,the issue is with
github_repository
data source (single repo data source, not multiple repo data source)That said, I too run into a similar issue. When referencing
data.github_repository.<name>.name
Terraform complains the related field is not set, implyingname
returnsnull
:variable "repositories" { type = map(string) } data "github_team" "administrators" { slug = "code-security" } data "github_repository" "owned" { for_each = var.repositories name = each.key } resource "github_team_repository" "maintainership" { for_each = data.github_repository.owned team_id = "@code-security" repository = each.value.name permission = "push" }
yields:
│ Error: "repository": required field is not set │ │ with module.repositories.github_team_repository.maintainership["my-repo"], │ on modules/repositories/main.tf line 40, in resource "github_team_repository" "maintainership": │ 40: resource "github_team_repository" "maintainership" { │ ╵
As there's no
includ_repo_id
flag for the single repo data source, I'd say something's off in the read function?
This issue actually masks the actual bug: loading up repositories not owned by the GITHUB_TOKEN does not raise an error if the repo isn't found. Instead of raising an error, it silently nulls all attributes instead.