SumoLogic / terraform-provider-sumologic

Terraform provider for Sumo Logic
https://www.terraform.io/docs/providers/sumologic/
Mozilla Public License 2.0
40 stars 57 forks source link

SUMO-247498 Add hashAlgorithm to common source properties #686

Closed yuting-liu closed 2 months ago

yuting-liu commented 2 months ago

Add the hashalgorithm field to common source properties.

yuting-liu commented 2 months ago

Already tested it locally:

Terraform will perform the following actions:

  # sumologic_collector.collector will be created
  + resource "sumologic_collector" "collector" {
      + id       = (known after apply)
      + name     = "yuting-test-tf-collector"
      + timezone = "Etc/UTC"
    }

  # sumologic_http_source.test-http-source-empty will be created
  + resource "sumologic_http_source" "test-http-source-empty" {
      + automatic_date_parsing       = true
      + category                     = "my/source/category"
      + collector_id                 = (known after apply)
      + cutoff_timestamp             = 0
      + force_timezone               = false
      + id                           = (known after apply)
      + message_per_request          = false
      + multiline_processing_enabled = true
      + name                         = "test-http-source-empty"
      + url                          = (known after apply)
      + use_autoline_matching        = true
    }

  # sumologic_http_source.test-http-source-md5 will be created
  + resource "sumologic_http_source" "test-http-source-md5" {
      + automatic_date_parsing       = true
      + category                     = "my/source/category"
      + collector_id                 = (known after apply)
      + cutoff_timestamp             = 0
      + force_timezone               = false
      + hash_algorithm               = "MD5"
      + id                           = (known after apply)
      + message_per_request          = false
      + multiline_processing_enabled = true
      + name                         = "test-http-source-md5"
      + url                          = (known after apply)
      + use_autoline_matching        = true
    }

  # sumologic_http_source.test-http-source-sha-256 will be created
  + resource "sumologic_http_source" "test-http-source-sha-256" {
      + automatic_date_parsing       = true
      + category                     = "my/source/category"
      + collector_id                 = (known after apply)
      + cutoff_timestamp             = 0
      + force_timezone               = false
      + hash_algorithm               = "SHA-256"
      + id                           = (known after apply)
      + message_per_request          = false
      + multiline_processing_enabled = true
      + name                         = "test-http-source-sha-256"
      + url                          = (known after apply)
      + use_autoline_matching        = true
    }

Plan: 4 to add, 0 to change, 0 to destroy.

Thus, it will have the consistent behavior as we created sources via UI/API. If hash_algorithm is not explicitly specified, it won't be shown in the source serialization json. If it's explicitly mentioned, it will use either SHA-256 or MD5 as specified.