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-237992: Fix perpetual diff in Extraction Rules by normalizing the parse expression #638

Closed chetankme closed 8 months ago

chetankme commented 8 months ago

Testing: Installed the provider locally and the FER which was perpetually showing changes showed no diff.

~/git/sumo-tf-test
▶ terraform apply
time_sleep.wait_for_10_seconds: Refreshing state... [id=2024-03-26T20:02:05Z]
sumologic_field_extraction_rule.CMeenaTest_AwsObservabilityAlbAccessLogsFER: Refreshing state... [id=0000000000017323]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # sumologic_field_extraction_rule.CMeenaTest_AwsObservabilityAlbAccessLogsFER will be updated in-place
  ~ resource "sumologic_field_extraction_rule" "CMeenaTest_AwsObservabilityAlbAccessLogsFER" {
        id               = "0000000000017323"
        name             = "CMeenaTest_AwsObservabilityAlbAccessLogsFER"
      ~ parse_expression = <<-EOT
          - parse "* * * * * * * * * * * * \"*\" \"*\" * * * \"*\"" as Type, DateTime, loadbalancer, Client, Target, RequestProcessingTime, TargetProcessingTime, ResponseProcessingTime, ElbStatusCode, TargetStatusCode, ReceivedBytes, SentBytes, Request, UserAgent, SslCipher, SslProtocol, TargetGroupArn, TraceId
          + | parse "* * * * * * * * * * * * \"*\" \"*\" * * * \"*\"" as Type, DateTime, loadbalancer, Client, Target, RequestProcessingTime, TargetProcessingTime, ResponseProcessingTime, ElbStatusCode, TargetStatusCode, ReceivedBytes, SentBytes, Request, UserAgent, SslCipher, SslProtocol, TargetGroupArn, TraceId
                          | where Type in ("http", "https", "h2", "grpcs", "ws", "wss")
                          | where !isBlank(loadbalancer)
                          | "aws/applicationelb" as namespace
                          | tolowercase(loadbalancer) as loadbalancer | fields loadbalancer, namespace
        EOT
        # (2 unchanged attributes hidden)
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

sumologic_field_extraction_rule.CMeenaTest_AwsObservabilityAlbAccessLogsFER: Modifying... [id=0000000000017323]
sumologic_field_extraction_rule.CMeenaTest_AwsObservabilityAlbAccessLogsFER: Modifications complete after 1s [id=0000000000017323]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

~/git/sumo-tf-test
▶ terraform plan
time_sleep.wait_for_10_seconds: Refreshing state... [id=2024-03-26T20:02:05Z]
sumologic_field_extraction_rule.CMeenaTest_AwsObservabilityAlbAccessLogsFER: Refreshing state... [id=0000000000017323]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # sumologic_field_extraction_rule.CMeenaTest_AwsObservabilityAlbAccessLogsFER will be updated in-place
  ~ resource "sumologic_field_extraction_rule" "CMeenaTest_AwsObservabilityAlbAccessLogsFER" {
        id               = "0000000000017323"
        name             = "CMeenaTest_AwsObservabilityAlbAccessLogsFER"
      ~ parse_expression = <<-EOT
          - parse "* * * * * * * * * * * * \"*\" \"*\" * * * \"*\"" as Type, DateTime, loadbalancer, Client, Target, RequestProcessingTime, TargetProcessingTime, ResponseProcessingTime, ElbStatusCode, TargetStatusCode, ReceivedBytes, SentBytes, Request, UserAgent, SslCipher, SslProtocol, TargetGroupArn, TraceId
          + | parse "* * * * * * * * * * * * \"*\" \"*\" * * * \"*\"" as Type, DateTime, loadbalancer, Client, Target, RequestProcessingTime, TargetProcessingTime, ResponseProcessingTime, ElbStatusCode, TargetStatusCode, ReceivedBytes, SentBytes, Request, UserAgent, SslCipher, SslProtocol, TargetGroupArn, TraceId
                          | where Type in ("http", "https", "h2", "grpcs", "ws", "wss")
                          | where !isBlank(loadbalancer)
                          | "aws/applicationelb" as namespace
                          | tolowercase(loadbalancer) as loadbalancer | fields loadbalancer, namespace
        EOT
        # (2 unchanged attributes hidden)
    }

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

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.

~/git/sumo-tf-test
▶ terraform plan
╷
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│  - sumologic/sumologic in /Users/cmeena/go/bin
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
time_sleep.wait_for_10_seconds: Refreshing state... [id=2024-03-26T20:02:05Z]
sumologic_field_extraction_rule.CMeenaTest_AwsObservabilityAlbAccessLogsFER: Refreshing state... [id=0000000000017323]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.