tpretz / terraform-provider-zabbix

Terraform Zabbix Provider
MIT License
30 stars 27 forks source link

zabbix_item_trapper is failing with: Error: -32602 (Invalid params.): Invalid parameter "/1": unexpected parameter "data_type". #32

Open hongyecc opened 1 year ago

hongyecc commented 1 year ago

I am trying to use this provider to create zabbix trapper item with zabbix server 6.4.3 (api version is also 6.4.3) but getting:

│ Error: -32602 (Invalid params.): Invalid parameter "/1": unexpected parameter "data_type".
│
│   with zabbix_item_trapper.zabbix["running-process-count"],
│   on main.tf line 75, in resource "zabbix_item_trapper" "zabbix":
│   75: resource "zabbix_item_trapper" "zabbix" {

My terraform plan output looks like this:

  # zabbix_item_trapper.zabbix["running-process-count"] will be created
  + resource "zabbix_item_trapper" "zabbix" {
      + history   = "7d"
      + hostid    = "10792"
      + id        = (known after apply)
      + key       = "running-process-count"
      + name      = "running-process-count"
      + trends    = "365d"
      + valuetype = "unsigned"
    }

My terraform version:

terraform version
Terraform v1.5.0
on darwin_arm64
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/tpretz/zabbix v0.17.0

Any idea what is going on?

DevOpsFu commented 4 months ago

It looks like the data_type field was removed from the item object API way back in the upgrade from version 3.2 to 3.4. It's listed as a "Backward incompatible change" here:

https://www.zabbix.com/documentation/3.4/en/manual/api/changes_3.2_-_3.4

Fixing this will be a case of dealing with it in the go-zabbix-api package. I'm really surprised this hasn't been noticed sooner, given that this API change was released 7 years ago!

johnnytan2885 commented 13 hours ago

Is this issue still persists? It's also happening when I'm trying to create zabbix_item_simple