This template blocks packets destined for a specific IP and port using a stateful rule group in AWS Network Firewall.

Terraform Template

resource "aws_networkfirewall_rule_group" "example" {
  capacity = 100
  name = "example"

  rule_group {

    rules_source {

      stateful_rule {
        action = "DROP"

        header {
          destination = "124.1.1.24/32"
          destination_port = "53"
          direction = "ANY"
          protocol = "TCP"
          source = "1.2.3.4/32"
          source_port = "53"
        }

        rule_option {
          keyword = "sid"
          settings = ["1"]
        }
      }
    }
  }

  tags = {
    Tag1 = "Value1"
    Tag2 = "Value2"
  }
  type = "STATEFUL"
}