Trying to match 2 strings

Hey all, I am trying to match either or 2 strings with regex, but I can’t seem to get the format correct for this in TF. Can anyone help on how to match either publicweb or pciweb?

This is what I’m trying:

regexall("(publicweb|pciweb)", var.vpc.vpc1.routes)

I’ve tried a few different combinations with no luck.

What type of data is


Bear in mind that regexall matches within a single string. That variable name suggests it’s probably some more complex kind of data.

If you want to match those two string values exactly, my typical recommendation would be to use the contains function like this:

contains(["publicweb", "pciweb"], var.vpc.vpc1.routes)

Though as @maxb noted, this would work only if var.vpc.vpc1.routes is itself a string. If the above isn’t sufficient to answer your question, I’d suggest sharing a fuller example of what you tried and information about what happened when you tried it.