I\'m looking at using the new conditionals in Terraform v0.11 to basically turn a config block on or off depending on the evnironment.
Here\'s the b
Expanding on Juho Rutila’s answer too; I like to use the range function for this use case:
range
dynamic "access_logs" { for_each = range(var.environment_name == "production" ? 1 : 0) contents { bucket = "my-bucket" prefix = "${var.environment_name}-alb" } }
range(n) produces a n-element list.
range(n)