Open aglasson opened 3 hours ago
Hey there @aglasson
Sorry it's not working for you, thanks for flagging this. It sounds like it might be an OPNsense 24.7 issue.
I can confirm everything works for me on: OPNsense: 24.1 Terraform: 1.9.5 Provider: 0.10.1
I'm installing OPNsense 24.7 on a test VM now to try and troubleshoot this. I'll get back to you.
Just checking, you created API keys like this (v) here? (under System > Access > Users)
I haven't played around too much with the OPNsense RBAC, but for my setup the provider works with API keys created under the default root
user in the admins
group, although you said you tested this.
Just got OPNsense 24.7 installed and it seems to work correctly for me.
Here is my setup verbatim:
```tf
# versions.tf
terraform {
required_version = "~> 1.9.5"
required_providers {
opnsense = {
source = "browningluke/opnsense"
version = "~> 0.10.1"
}
}
}
```
```tf
# main.tf
provider "opnsense" {
uri = "https://
With this code I get the expected: Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
This provider actually echos the requests it makes to/from OPNsense in the TF debug log. Try run:
TF_LOG=DEBUG terraform apply
If you spot the bug, great! If not, redact out your private values (URL / Auth Header) and post the output here and I'll take a look.
I've basically tried to create every type of resource in OPNsense with Terraform and I keep getting the same error. I can read data from existing configuration in OPNsense and outputting it in Terraform no problem at all. Its basically like the API keys are read only. I've created a key on root and also created a new user, granted all access and created a key on that user to no avail. Has something perhaps changed in the OPNSense or Terraform latest version and stopping this provider from working perhaps?
This is my first time using OPNSense and this Terraform provider. I have years of experience with PFSense, I'm trying to move to OPNSense purely for the benefit of configuring my router with desired state IaC.
I've looked at the terraform debug logs and I seem to get no more helpful information than that. If I remove any
resource
elements from my .tf file and only havedata
andoutput
elements, terraform outputs the data to console perfectly with no errors.Version info: OPNsense: 24.7 Terraform: 1.9.5 Provider: 0.10.1
For example I get this error with the most basic of resource config, nothing else in my main.tf, terraform.tf has just my provider config: