integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
870 stars 708 forks source link

[FEAT]: Fetch data.github_tree from a specific owner #2071

Open Tiino1 opened 6 months ago

Tiino1 commented 6 months ago

Describe the need

Exactly like data.github_repository_file we would like to be able to use data.github_tree while specifying the owner

Desired behaviour:

data "github_repository" "this" {
  name = "example"
}

data "github_branch" "this" {
  branch     = data.github_repository.this.default_branch
  repository = data.github_repository.this.name
}

data "github_tree" "this" {
  recursive  = false
  repository = "my_owner/${data.github_repository.this.name}"
  tree_sha   = data.github_branch.this.sha
}

If a repository of the type "owner/repo" (with a slash in the middle) is passed, the owner would be as specified and not the owner of the token

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

kfcampbell commented 6 months ago

I would love to standardize this across all our resources. We have an unfortunate mix of behavior around this.