Closed Morpheus0x closed 2 years ago
I found the problem: The interface name wasn't correct. I expected it to be the same as shown in the GUI, but it wasn't. I looked at the source code for this provider and found out that it basically just simulates a user configuring the firewall using the browser, there I found out that I need to look for the if
value in the request form data. By using dev tools in the browser, creating a static lease and looking at the request form data, I found out that I have to write lowercase lan
as interface name. Also if you are using vlans, the interface name isn't at all intuitive(e.g. my 2nd vlan interface is called opt7) and the only way to get the interface name that is needed by the provider is by looking at the request in dev tools.
The good thing is, that this doesn't change, so you only have to look that up once. A good idea would be to define a terraform data source that matches the name of your interface in opnsense and contains the string for the interface.
Just to add to this conversation, I believe you can also see the interface name to use in the _opnsense_dhcp_staticmap resource from the url in OPNSense. I.e. when going to Services » DHCPv4 » LAN, you can see the interface name in the url: https://<opnsense_url>/services_dhcp.php?if=lan
System Information
Linux distribution
Debian 11
Terraform version
Terraform v1.2.3
Provider versions
0.3.0
Description of Issue/Question
Setup
infra.tf
Steps to Reproduce Issue
Running
terraform apply
produces the following output and stacktraceI logged in to opnsense after running
terraform apply
and the Reporter caught an error:This would mean that there was an issue with configuring the DNS Override via API, however the override was successfully added:
The issue is, that the DHCP Static Lease isn't configured.
Additional information:
I made sure that my opnsense firewall has a valid ssl certificate and that username and password are correct