Kaginari / terraform-provider-mongodb

Terraform provider for mongodb instance (selfhosted, AWS documentDB and cloud instances )
MIT License
26 stars 33 forks source link

Sort privileges before inserting and comparing #38

Open julianogv opened 1 year ago

julianogv commented 1 year ago

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"
        }
    }