Im trying to create a stateful rule for aws network firewall using terraform.
The problem that i face, is that im not able to put multiple values for such parameters as “destination”,“source”,“destination_port”,“source_port”.
The error that im receiving while trying to provide something like:
‘destination = [“$variable1”,“$variable2”]’
is:
“Inappropriate value for attribute “destination”: string required.”
From documentation - Terraform Registry , as i have understood it is possible to pass “An IP address or a block of IP addresses in CIDR notation” , but only for stateless rules?
@OneOfTheJohns The documentation (which is the same as that of AWS API reference) isn’t very clear on this, but you can indeed specify a list of IPs, CIDR ranges, or variable names (if defined in rule group) in the string notation. I had to look at a rule definition AWS CLI to cross-check… Here’s an example for a standard stateful rule:
If you are maintaining IP addresses as list variables in Terraform, you should be able to use the jsonencode function to convert it into string and pass that as arguments in the resource.