integrations / integrations/terraform-provider-github
[FEAT]: Support for `terraform query`
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 8
Description
### Describe the need
Hello!
In [Terraform version 1.14](https://github.com/hashicorp/terraform/releases/tag/v1.14.0) the `terraform query` command was introduced. This command executes list operations against existing infrastructure and displays the results. The command can optionally generate configuration for importing results into Terraform.
Currently this does not work for GitHub resources defined in the provider presumably because `list` resources are not supported.
### Example import.tfquery.hcl file
```
list "github_membership" "org_owner" {
provider = github
config {
username = "one-cool-user"
role = "admin"
}
}
```
### `terraform query` command output
```
terraform query
╷
│ Error: Invalid list resource
│
│ on import.tfquery.hcl line 1, in list "github_membership" "org_owner":
│ 1: list "github_membership" "org_owner" {
│
│ The provider integrations/github does not support list resource "github_membership".
```
Is there a plan to implement this functionality? Currently, users will need to use the `terraform import` command repeatedly. Potentially for thousands of resources if they're trying to import a large GitHub ecosystem to Terraform.
Reference HashiCorp documentation: https://developer.hashicorp.com/terraform/language/v1.14.x/import/bulk
Thanks for the great work!
Sam
### SDK Version
_No response_
### API Version
_No response_
### Relevant log output
```shell
### Example import.tfquery.hcl file
list "github_membership" "org_owner" {
provider = github
config {
username = "one-cool-user"
role = "admin"
}
}
### `terraform query` command output
terraform query
╷
│ Error: Invalid list resource
│
│ on import.tfquery.hcl line 1, in list "github_membership" "org_owner":
│ 1: list "github_membership" "org_owner" {
│
│ The provider integrations/github does not support list resource "github_membership".
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.