Conditional statement in nested block Azure web app

I have 4 environments all exactly the same (for the sake of this questions anyways) and I am trying to set some IP restrictions on 3 of the 4 environments in my azure web app, how would I tell terraform that if it is this one specific environment to not put the ip restrictions on? I tried the dynamic block but it did like anything that I was putting in there.

any help is appreciated!!

Please see: Guide to asking for help in this forum

maybe this will help, here is what I am trying to accomplish

“if local.environment != “pr” do this, else do nothing”

Since you haven’t given details about what “this” is, that does not enable any further help to be given.

if local.environment does not equal “pr” then add the ip restrictions to the web app, if local. environment does equal “pr” do not add the ip restrictions

Does this help?

here is the ip_restrictions block and below that is some of the things I have tried to enter in there without success

ip_restriction { 
        name       = "Testname"
        ip_address = ""
        action     = "Allow"
        priority   = "796"

count = local.environment == "pr" ? 1 : 0

for_each = local.environment ? [] : ["pr"]

for_each = local.environment ? [] : ["1"]

value = [for x in local.environment: if == "pr"]