terraform-provider-fortios
terraform-provider-fortios copied to clipboard
Generating firewall policy from csv
I am trying to create firewall policy by importing the variables from csv file. Error is only seen when I create from the csv. If I directly put the variables in tf file then it works fine. Please help.
Current version FortiOS v7.0.0 build0066 (GA)
Terraform : Terraform version: 0.14.3
CSV format :
| sequence | Name | srcaddr | destaddr | svc | srcintf | destintf |
|---|---|---|---|---|---|---|
| 1 | NTP | all | all | all | port4 | port3 |
terraform { required_providers { fortios = { source = "fortinetdev/fortios" version = "1.13.1" } } }
locals { firewall_rules = csvdecode(file("${path.module}/test.csv")) }
provider "fortios" { hostname = "" token = "" insecure = "true" }
resource "fortios_firewall_policy" "forttirules" { for_each = {for frule in local.firewall_rules : frule.sequence => frule} action = "accept" inspection_mode = "flow" ippool = "disable" logtraffic = "utm" name = "d3" nat = "enable" status = "enable"
dstaddr { name = each.value.destaddr }
dstintf { name = each.value.destintf }
service { name = each.value.svc }
srcaddr { name = each.value.srcaddr }
srcintf { name = each.value.srcintf } }
Tf apply output with trace logging is attached. tf-trace.txt
Hi @jsingh126 ,
Thank you for raising this issue. It seems like a parameter issue. Could you change the value of svc to uppercase letters "ALL", and try it again?
Please let me know if this issue still exist.
Thanks, Xing
Hi all,
I will go ahead to close this case, please feel free to reopen it or another case if you still have questions.
Thanks, Maxx