Skip to content

[bug] "boundary_group" data source name does not do the exact name match #740

@tadasjuoz

Description

@tadasjuoz

Situation

When defining two boundary_group data sources with same name prefixes I get an error:

Error: error found more than 1 group

Data sources definition:

data "boundary_group" "group1" {
  name = "grp-t17-engineers"
  scope_id = "o_FSBMtTyl9m"
}

data "boundary_group" "group2" {
  name = "grp-t17-elevated"
  scope_id = "o_FSBMtTyl9m"
}

Expected Behavior

Data sources should output information on resources based on exact name match.

Actual Behavior

If more than one Boundary group name in defined scope has the same prefix mentioned error occurs.

Steps to Reproduce

Create two groups under the same scope (in my case - groups created under the same project.) with the same name prefix. e.g.(grp-t17*):
grp-t17-elevated
grp-t17-engineers

Define data sources for both or a single group in the Terraform template and run terraform plan.

Possible root cause

In internal/provider/filter.go

[func FilterWithItemNameMatches(name string) string {
	return fmt.Sprintf("\"/item/name\" matches \"%s\"", name)
}](url)

Function uses "matches" which is a regex based operator which would explain why more than one group is found even with unique group names.
"==" would make more sense to use here - https://developer.hashicorp.com/boundary/docs/filtering?utm_source=chatgpt.com#matching-operators

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions