Using Wildcards #478
-
I have a policy (that works!) -- How would one implement wildcards so that it is read?
Allow buckets if they start with I did see that ( _ ) is used, and when I tried variations in line 3, the underscore is always considered an error or unsafe except the following;
and that doesn't give me the results needed. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
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 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 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 :) |
Beta Was this translation helpful? Give feedback.
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:If you're requirement is that every bucket name starts with "comp-", you could use the
every
construct, like:Obviously might look somewhat different depending on your requirements, but that should be somewhere to start from :)