What happened?
Two examples in kosli snapshot ecs --help use "*-prod-*" as a regex pattern (cmd/kosli/snapshotECS.go:74 and :86). The --*-regex flags are compiled as Go RE2 regexes (internal/filters/resourceFilter.go), and a leading * is not valid:
error parsing regexp: missing argument to repetition operator: `*`
Anyone copying the example gets a failed snapshot, and only after the AWS API calls have already run (the error surfaces from ShouldInclude via internal/aws/aws.go:716).
Steps to reproduce
kosli snapshot ecs my-env --services-regex "*-prod-*" ...
- Same for
--exclude-services-regex "*-prod-*".
Fix
Use ".*-prod-.*" in both examples.
The remaining regex examples ("my-cluster-*", "backend-*" on lines 53, 62, 71, 83) do compile, but they read as globs: -* means "zero or more hyphens", and matching is unanchored, so they effectively mean "contains backend". Worth tightening so the examples teach regex rather than glob.
What happened?
Two examples in
kosli snapshot ecs --helpuse"*-prod-*"as a regex pattern (cmd/kosli/snapshotECS.go:74and:86). The--*-regexflags are compiled as Go RE2 regexes (internal/filters/resourceFilter.go), and a leading*is not valid:Anyone copying the example gets a failed snapshot, and only after the AWS API calls have already run (the error surfaces from
ShouldIncludeviainternal/aws/aws.go:716).Steps to reproduce
kosli snapshot ecs my-env --services-regex "*-prod-*" ...--exclude-services-regex "*-prod-*".Fix
Use
".*-prod-.*"in both examples.The remaining regex examples (
"my-cluster-*","backend-*"on lines 53, 62, 71, 83) do compile, but they read as globs:-*means "zero or more hyphens", and matching is unanchored, so they effectively mean "containsbackend". Worth tightening so the examples teach regex rather than glob.