For_each conditionally add block in resource

Your primary problem is this line right here that can’t result in anything except null:

for_each = each.value.cors == null ? null : each.value.cors

The expression reads as:

if each.value.cors is null, then assign null, else assign each.value.cors which is null.

1 Like