terraform-provider-mongodb icon indicating copy to clipboard operation
terraform-provider-mongodb copied to clipboard

Sort privileges before inserting and comparing

Open julianogv opened this issue 1 year ago • 0 comments

Hi there. First, thanks for the good work with this provider, It has been very useful.

I've noticed that every time I run a terraform plan, it shows a difference between existing and new privileges, due to the order of actions' list.

As you can see below, the actions' lists are the same, only the order is different. Maybe sorting before inserting and comparing would solve the problem.

  ~ resource "mongodb_db_role" "role" {
        id       = "REDACTED"
        name     = "REDACTED"
        # (1 unchanged attribute hidden)

      - privilege {
          - actions    = [
              - "find",
              - "insert",
              - "remove",
              - "update",
            ] -> null
          - collection = "REDACTED" -> null
          - db         = "REDACTED" -> null
        }
      + privilege {
          + actions    = [
              + "find",
              + "insert",
              + "update",
              + "remove",
            ]
          + collection = "REDACTED"
          + db         = "REDACTED"
        }
    }

julianogv avatar Jul 19 '23 18:07 julianogv