samedi 25 février 2017

Terraform conditional block based on environment

I'm looking at using the new conditionals in Terraform to basically turn a config block on or off depending on the evnironment.

Here's the block that I'd like to make into a conditional, if, for example I have a variable to turn on for production.

access_logs {
    bucket = "my-bucket"
    prefix = "${var.environment_name}-alb"
}

I think I have the logic for checking the environment conditional, but I don't know how to stick the above configuration into the logic.

"${var.environment_name == "production" ? 1 : 0 }"

Is it possible to turn the access_logs block on and off via the environment_name variable? If this is not possible, is there a workaround?

Aucun commentaire:

Enregistrer un commentaire