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 = []