outputs.tf 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. output "name" {
  2. value = digitalocean_firewall.this.name
  3. }
  4. output "inbound_rule_count" {
  5. value = length(digitalocean_firewall.this.inbound_rule)
  6. }
  7. output "outbound_rule_count" {
  8. value = length(digitalocean_firewall.this.outbound_rule)
  9. }
  10. # Sorted "<protocol>/<port_range>/<destinations>" descriptors for the
  11. # address-based outbound rules, so tests (and the stacks that call this module)
  12. # can pin the exact set. Tag-scoped rules are in outbound_tag_rules. No secrets.
  13. output "outbound_rules" {
  14. value = sort([
  15. for r in digitalocean_firewall.this.outbound_rule :
  16. "${r.protocol}/${r.port_range}/${join(",", sort(tolist(r.destination_addresses)))}"
  17. if length(coalesce(r.destination_addresses, [])) > 0
  18. ])
  19. }
  20. # Sorted "<protocol>/<port_range>/<source tags>" descriptors for the inbound rules.
  21. output "inbound_rules" {
  22. value = sort([
  23. for r in digitalocean_firewall.this.inbound_rule :
  24. "${r.protocol}/${r.port_range}/${join(",", sort(tolist(r.source_tags)))}"
  25. ])
  26. }
  27. # Sorted "<protocol>/<port_range>/<destination tags>" descriptors for the outbound
  28. # rules that reach droplets by tag.
  29. output "outbound_tag_rules" {
  30. value = sort([
  31. for r in digitalocean_firewall.this.outbound_rule :
  32. "${r.protocol}/${r.port_range}/${join(",", sort(tolist(r.destination_tags)))}"
  33. if length(coalesce(r.destination_tags, [])) > 0
  34. ])
  35. }
  36. # The module contract (docs/superpowers/specs/2026-10-16-multicloud-design.md,
  37. # section 5). These names are the same on every provider; see README.md for the
  38. # role table.
  39. output "id" {
  40. description = "Identifier a stack can depend on."
  41. value = digitalocean_firewall.this.id
  42. }
  43. # What the rules attach to. On DigitalOcean this is the tag the firewall applies to.
  44. output "rule_targets" {
  45. value = sort(tolist(digitalocean_firewall.this.tags))
  46. }
  47. # Who may reach the targets by membership rather than by address. Here: the source tags.
  48. output "source_members" {
  49. value = sort(distinct(flatten([for r in digitalocean_firewall.this.inbound_rule : tolist(r.source_tags)])))
  50. }
  51. # What the targets may reach by membership rather than by address. Here: the destination tags.
  52. output "destination_members" {
  53. value = sort(distinct(flatten([for r in digitalocean_firewall.this.outbound_rule : tolist(coalesce(r.destination_tags, []))])))
  54. }