Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Sweeper '-sweep-run' flag to use regexp match when filtering sweepers to run #74

Open
ewbankkit opened this issue Jan 9, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@ewbankkit
Copy link
Contributor

SDK version

$ go mod edit -json | jq '.Require[] | select(.Path=="github.com/hashicorp/terraform-plugin-sdk")'
{
  "Path": "github.com/hashicorp/terraform-plugin-sdk",
  "Version": "v1.4.0"
}

Use-cases

When running something like

$ TEST=./aws SWEEP=us-west-2 SWEEPARGS=-sweep-run=aws_xxx make sweep

the sweeper for resources like aws_xxx_attachment are run even if they are not declared as dependencies of aws_xxx.
This is because filterSweepers() uses strings.Contains() on the sweeper name to determine if it should be run.
Changing this to a regexp match would allow exact matches (^aws_xxx$) as well as being backwards compatible.

@ewbankkit ewbankkit added the enhancement New feature or request label Jan 9, 2020
@kmoe kmoe self-assigned this Jan 27, 2020
@bflad
Copy link
Contributor

bflad commented Feb 28, 2023

With the introduction of the terraform-plugin-testing module (migration guide), we are transferring feature requests relating to the helper/resource "testing framework" in the terraform-plugin-sdk repository over to the new terraform-plugin-testing repository.

@bflad bflad transferred this issue from hashicorp/terraform-plugin-sdk Feb 28, 2023
@kmoe kmoe removed their assignment Mar 1, 2023
@SarahFrench
Copy link
Member

I'd be happy to open a PR for this- I ran into this issue yesterday and would prefer a strict match instead of Contains

@austinvalle
Copy link
Member

One thing to consider if you look to open a PR (definitely welcome 🙂) is how to handle potential commas in regex statements, since -sweep-run is a comma separated list. We could also consider a new complimentary -sweep-run-regex flag if we want to avoid that problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants