terraform-provider-tfe
terraform-provider-tfe copied to clipboard
tfe_workspace_ids support to filter excluding specific tags
It would be nice to be able to exclude specific tags from the data source. i.e. all workspaces with tags "aws" and "app" but NOT "prod".
data "tfe_workspace_ids" "non-prod-apps" {
tag_names = [!"prod", "app", "aws"]
organization = "my-org-name"
}
I did accomplish the same effect by using setsubtract(), but it would be much cleaner if the data lookup supported the idea of excluding specific tags from the results.
setsubtract(values(data.tfe_workspace_ids.aws.ids), values(data.tfe_workspace_ids.aws_prod.ids))
We can add a exclude_tags field to this data source that will locally filter from the returned set. How does this sound?
This was released as part of v0.32.0 earlier this year