From 7c21a1e8991e5517512c59d6181a9108747ec935 Mon Sep 17 00:00:00 2001 From: swetha1654 Date: Thu, 24 Apr 2025 18:32:47 +0530 Subject: [PATCH] Add conditional expose directive --- terraform/main.tf | 5 +++++ terraform/variables.tf | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/terraform/main.tf b/terraform/main.tf index e55420a960..e38c14628a 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -16,4 +16,9 @@ resource "juju_application" "machine_postgresql" { units = var.units constraints = var.constraints config = var.config + + dynamic "expose" { + for_each = var.enable_expose ? [1] : [] + content {} + } } diff --git a/terraform/variables.tf b/terraform/variables.tf index ede475f37a..987bb16ba0 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -50,3 +50,9 @@ variable "config" { type = map(string) default = {} } + +variable "enable_expose" { + type = bool + default = true + description = "Whether to expose the application" +}