From 1b7da15a7e57e6811d5f8eedbf3bfc1c9664f424 Mon Sep 17 00:00:00 2001 From: mahesh yadav Date: Tue, 11 Jul 2023 13:45:23 +0530 Subject: [PATCH] fix: update count condition --- main.tf | 2 +- variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 3663190..23b47a2 100644 --- a/main.tf +++ b/main.tf @@ -64,7 +64,7 @@ resource "digitalocean_firewall" "default" { #Description : Provides a DigitalOcean database firewall resource allowing you to restrict connections to your database to trusted sources. ##------------------------------------------------------------------------------------------------------------------------------------------ resource "digitalocean_database_firewall" "default" { - count = var.enabled == true && var.database_cluster_id != null ? 1 : 0 + count = var.enabled == true && var.database_firewall_enabled && var.database_cluster_id != null ? 1 : 0 cluster_id = var.database_cluster_id diff --git a/variables.tf b/variables.tf index 9d71668..bcbe998 100644 --- a/variables.tf +++ b/variables.tf @@ -31,6 +31,12 @@ variable "enabled" { description = "Flag to control the firewall creation." } +variable "database_firewall_enabled" { + type = bool + default = false + description = "Flag to control the firewall creation." +} + variable "allowed_ip" { type = list(any) default = []