site24x7 / terraform-provider-site24x7

Terraform provider for Site24x7
MIT License
22 stars 33 forks source link

RestAPI resource weird behaviour with json_schema attribute #296

Open athiththan11 opened 1 month ago

athiththan11 commented 1 month ago

Description

I am seeing the below error when trying to create a REST API monitor with the Site24x7 provider

Error: json: cannot unmarshal string into Go struct field RestApiMonitor.json_schema of type map[string]interface {}

Given below is my Terraform configuration

resource "site24x7_rest_api_monitor" "health" {
  display_name          = "REST API"
  website               = var.endpoint
  check_frequency       = "5"
  location_profile_name = "Global Monitoring"
  timeout               = 30
  use_ipv6              = false

  response_content_type = "J"
  match_json_path = [
    "$.keys[0].[?(@.kty != \"\")]",
    "$.keys[0].[?(@.use != \"\")]",
    "$.keys[0].[?(@.alg != \"\")]",
    "$.keys[0].[?(@.kid != \"\")]",
    "$.keys[0].[?(@.x5c != \"\")]",
    "$.keys[0].[?(@.x5t#S256 != \"\")]",
    "$.keys[0].[?(@.n != \"\")]",
    "$.keys[0].[?(@.e != \"\")]"
  ]
  match_json_path_severity  = 0
  json_schema_check         = false
  response_headers_severity = 2

  http_method     = "G"
  use_name_server = false
  up_status_codes = "200"
  http_protocol   = "H1.1"
  use_alpn        = false
}

Terraform versions are as following

I found a similar issue reported in https://github.com/site24x7/terraform-provider-site24x7/issues/113, however the explanation given doesn't align with the behaviour that I am observing.