Skip to content

Commit

Permalink
Merge pull request #12 from terraform-do-modules/internal-425
Browse files Browse the repository at this point in the history
fix: make dynamic outbound rule
  • Loading branch information
d4kverma authored Jul 26, 2023
2 parents b5a7215 + 6b25e9b commit 157dd58
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
17 changes: 7 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,13 @@ resource "digitalocean_firewall" "default" {
}
}

outbound_rule {
protocol = "tcp"
port_range = "1-65535"
destination_addresses = ["0.0.0.0/0", "::/0"]
}

outbound_rule {
protocol = "udp"
port_range = "1-65535"
destination_addresses = ["0.0.0.0/0", "::/0"]
dynamic "outbound_rule" {
for_each = var.outbound_rule
content {
protocol = outbound_rule.value.protocol
port_range = outbound_rule.value.port_range
destination_addresses = outbound_rule.value.destination_addresses
}
}

tags = [
Expand Down
24 changes: 24 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,28 @@ variable "inbound_rules" {
type = any
default = []
description = "List of objects that represent the configuration of each inbound rule."
}
variable "outbound_rule" {
type = list(object({
protocol = string
port_range = string
destination_addresses = list(string)
}))
default = [
{
protocol = "tcp"
port_range = "1-65535"
destination_addresses = [
"0.0.0.0/0",
"::/0"]
},
{
protocol = "udp"
port_range = "1-65535"
destination_addresses = [
"0.0.0.0/0",
"::/0"]
}
]
description = "List of objects that represent the configuration of each outbound rule."
}

0 comments on commit 157dd58

Please sign in to comment.