Mastercard / terraform-provider-restapi

A terraform provider to manage objects in a RESTful API
Other
808 stars 217 forks source link

search bool value #227

Open Mykhailo-Roit opened 1 year ago

Mykhailo-Roit commented 1 year ago

I need to search item by bool value search_value = true but this code does not work

data "restapi_object" "graylog_default_index_set" {
  provider     = restapi.graylog
  depends_on   = [module.graylog]
  id_attribute = "id"
  results_key  = "index_sets"
  path         = "/system/indices/index_sets?skip=0&limit=0&stats=false"
  search_key   = "default"
  search_value = true
}

Got an error Error: failed to get the value of 'default' in the results array at 'index_sets': object at path 'default' is not a JSON string or number (float64) - the go fmt package says it is 'bool'

Data is

  "index_sets": [
    {
      "id": "64959e1b04000b7964f6bc69",
      "title": "Default index set",
      "description": "The Graylog default index set",
      "can_be_default": true,
      "index_prefix": "graylog",
      "shards": 1,
      "replicas": 0,
      "rotation_strategy_class": "org.graylog2.indexer.rotation.strategies.TimeBasedRotationStrategy",
      "rotation_strategy": {
        "type": "org.graylog2.indexer.rotation.strategies.TimeBasedRotationStrategyConfig",
        "rotation_period": "P100D",
        "max_rotation_period": null,
        "rotate_empty_index_set": false
      },
      "retention_strategy_class": "org.graylog2.indexer.retention.strategies.ClosingRetentionStrategy",
      "retention_strategy": {
        "type": "org.graylog2.indexer.retention.strategies.ClosingRetentionStrategyConfig",
        "max_number_of_indices": 5
      },
      "creation_date": "2023-06-23T13:28:59.729Z",
      "index_analyzer": "standard",
      "index_optimization_max_num_segments": 1,
      "index_optimization_disabled": false,
      "field_type_refresh_interval": 5000,
      "index_template_type": null,
      "default": true,
      "writable": true
    },