go-tfe icon indicating copy to clipboard operation
go-tfe copied to clipboard

[Feature Request] Add filter options when listing Terraform Versions

Open straubt1 opened this issue 3 years ago • 5 comments

Terraform Versions have several attributes that can be filtered on:

  • official (true or false)
  • enabled (true or false)
  • beta (true or false)
  • usage (when 0 or non zero)

Suggesting adding these filters to the List() function -> https://github.com/hashicorp/go-tfe/blob/0f08d6bfbd92d4302a76a506d423976bb0535322/admin_terraform_version.go#L66

straubt1 avatar May 22 '21 18:05 straubt1

This would be great, but note that they can't currently be filtered on in the API, so the platform would have to add that before anything can be done for that here. I would suggest creating a field request for this as this issue tracker does not get reviewed for potential API additions to the platform.

chrisarcand avatar May 22 '21 23:05 chrisarcand

Thanks @chrisarcand! I thought this worked however checking again, you are correct, the enabled=true flag does not actually do anything when added to the query string :)

straubt1 avatar May 22 '21 23:05 straubt1

@straubt1 Hi Tom! We have recently added a filtering and searching functionality for listing terraform versions with go-tfe. Here is documentation for how to use those new query params: https://www.terraform.io/cloud-docs/api-docs/admin/terraform-versions#query-parameters Now I know this not exactly the feature you requested on this Github Issue, but I thought perhaps this new functionality could be helpful to the use case you have in mind 🤞. If this doesn't help for filtering/searching for enabled, official or beta versions the way you wanted, I'd be great if you can provide me with more details on the use cases that you'd be solving for by having a boolean for additional attributes. I appreciate the feedback!

uturunku1 avatar Feb 07 '22 18:02 uturunku1

I reached out to @straubt1 in Slack to find out if there are any remaining issues for this issue.

annawinkler avatar Feb 07 '23 22:02 annawinkler

Talking with @straubt1 and it sounds like the hope is that the feature could be available in the SDK one day and not just in the API, so I'll leave this open.

annawinkler avatar Mar 06 '23 23:03 annawinkler