Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestAPI resource weird behaviour with json_schema attribute #296

Open
athiththan11 opened this issue Jul 5, 2024 · 1 comment
Open

RestAPI resource weird behaviour with json_schema attribute #296

athiththan11 opened this issue Jul 5, 2024 · 1 comment

Comments

@athiththan11
Copy link

athiththan11 commented Jul 5, 2024

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

  • Site24x7 Provider: 1.0.90
  • Terraform: 0.14.10

I found a similar issue reported in #113, however the explanation given doesn't align with the behaviour that I am observing.

@bryanhorstmann
Copy link

bryanhorstmann commented Nov 18, 2024

Can confirm I'm seeing the same thing.
Provider: 1.0.92
Terraform: 1.9.8

11:07:58.455 STDERR terraform: ╷
11:07:58.456 STDERR terraform: │ Error: json: cannot unmarshal string into Go struct field RestApiMonitor.json_schema of type map[string]interface {}
11:07:58.456 STDERR terraform: │ 
11:07:58.456 STDERR terraform: │   with site24x7_rest_api_monitor.this["test"],
11:07:58.456 STDERR terraform: │   on main.tf line 1, in resource "site24x7_rest_api_monitor" "this":
11:07:58.456 STDERR terraform: │    1: resource "site24x7_rest_api_monitor" "this" {
11:07:58.456 STDERR terraform: │ 
11:07:58.456 STDERR terraform: ╵
11:07:58.864 STDOUT terraform: Releasing state lock. This may take a few moments...
11:07:58.968 ERROR  terraform invocation failed in .
11:07:58.968 ERROR  error occurred:

* Failed to execute "terraform apply -target site24x7_rest_api_monitor.this["test"]" in .
  ╷
  │ Error: json: cannot unmarshal string into Go struct field RestApiMonitor.json_schema of type map[string]interface {}
  │ 
  │   with site24x7_rest_api_monitor.this["test"],
  │   on main.tf line 1, in resource "site24x7_rest_api_monitor" "this":
  │    1: resource "site24x7_rest_api_monitor" "this" {
  │ 
  ╵
  
  exit status 1

Relevant resource code:

      response_content_type     = "J"
      match_json_path_severity  = 2
      json_schema_check         = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants