lacework / terraform-provider-lacework

Terraform Lacework provider
Mozilla Public License 2.0
17 stars 14 forks source link

bug: sort issue for "Cloud" event_categories for the lacework_alert_rule resource #442

Open dli-spoton opened 1 year ago

dli-spoton commented 1 year ago

Describe the bug The "Cloud" item in event_categories for lacework_alert_rule is always sorted to the last item in the list. Will result in perpetual drift for the resource if Terraform doesn't match. Doesn't seem to be the case for any of the other items in event_categories.

To Reproduce

resource "lacework_alert_rule" "jira" {
  name           = "jira-alert-rule"
  description    = "This is a test JIRA alert rule"
  alert_channels = [lacework_alert_channel_jira_cloud.jira.id]
  severities = [
    "Critical",
    "High",
  ]
  event_categories = [
    "App",
    "Cloud",
    "Compliance",
    "File",
    "Machine",
    "User",
    "Platform",
  ]
}
  1. Terraform apply
  2. Terraform plan
    
    # lacework_alert_rule.jira will be updated in-place
    ~ resource "lacework_alert_rule" "jira" {
      ~ event_categories        = [
            "App",
          + "Cloud",
            "Compliance",
            # (3 unchanged elements hidden)
            "Platform",
          - "Cloud",
        ]
        name = "jira-alert-rule"
        # (9 unchanged attributes hidden)
    }

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

3. Terraform apply
4. Terraform plan
```terraform
Terraform will perform the following actions:

  # lacework_alert_rule.jira will be updated in-place
  ~ resource "lacework_alert_rule" "jira" {
      ~ event_categories        = [
            "App",
          + "Cloud",
            "Compliance",
            # (3 unchanged elements hidden)
            "Platform",
          - "Cloud",
        ]
        name = "jira-alert-rule"
        # (9 unchanged attributes hidden)
    }

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

Expected behavior Changing the order of event_categories should not result in perpetual drift.

Please complete the following information):

dmurray-lacework commented 1 year ago

Hi @dli-spoton thank you for reporting this issue. I've raised an issue internally for this. https://lacework.atlassian.net/browse/GROW-1373