Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature Request]: Support "filter" clauses in the datasources #386

Open
abotau opened this issue Sep 5, 2024 · 1 comment
Open

[Feature Request]: Support "filter" clauses in the datasources #386

abotau opened this issue Sep 5, 2024 · 1 comment

Comments

@abotau
Copy link

abotau commented Sep 5, 2024

What feature would you like to have in the provider?

Would it be possible to add support for "filter" clauses in the datasources like it is done in some datasource of the AWS provider

# Find the latest available AMI that is tagged with Component = web
data "aws_ami" "web" {
  filter {
    name   = "state"
    values = ["available"]
  }

  filter {
    name   = "tag:Component"
    values = ["web"]
  }

  most_recent = true
}

this example comes from the datasource official documentation : https://developer.hashicorp.com/terraform/language/data-sources#example

example, AWS AMI datasources arguments : https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami#argument-reference

@sauterp
Copy link
Member

sauterp commented Sep 6, 2024

Thanks for this suggestion.
It's not exactly what you ask for but similar: For each data source we have a _list data source where you can match against different attributes with regex. See this example.

As far as I can tell, fulfills the same purpose as the filter clauses. Do you agree or am I missing something?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants