Skip to content

Using Wildcards #478

Aug 1, 2023 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Hi @l3112!

The wildcard can't be used in strings like that. I assume you want to test that any bucket name starts with "comp-"? A rule could then use the startswith built-in function:

allow {
    bucket := input.aws.s3.buckets[_]
    startswith(bucket.name.value, "comp-")
}

If you're requirement is that every bucket name starts with "comp-", you could use the every construct, like:

import future.keywords.every

allow {
    every bucket in input.aws.s3.buckets {
    	startswith(bucket.name.value, "comp-") 
    }
}

Obviously might look somewhat different depending on your requirements, but that should be somewhere to start from :)

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@anderseknert
Comment options

@l3112
Comment options

@anderseknert
Comment options

@l3112
Comment options

@anderseknert
Comment options

Answer selected by l3112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants