deploymenttheory / terraform-provider-jamfpro

Jamf Pro Terraform Provider/Plugin written with the TF Provider SDK v2. Written in go
Mozilla Public License 2.0
32 stars 11 forks source link

Configuration profile computer group IDs ordering #254

Closed w0de closed 3 months ago

w0de commented 4 months ago

I believe configuration profiles' assign computer group IDs are sorted in the API response by group ID. This diff should be suppressed.

Eg:

  # jamfpro_macos_configuration_profile.munki_shard_1 will be updated in-place
  ~ resource "jamfpro_macos_configuration_profile" "munki_shard_1" {
        id                  = "165"
        name                = "Munki - Shard 1"
        # (4 unchanged attributes hidden)

      ~ scope {
          ~ computer_group_ids = [
              - 126,
                70,
              + 126,
            ]
            # (7 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }

        # (1 unchanged block hidden)
    }

  # jamfpro_macos_configuration_profile.munki_shard_2 will be updated in-place
  ~ resource "jamfpro_macos_configuration_profile" "munki_shard_2" {
        id                  = "163"
        name                = "Munki - Shard 2"
        # (4 unchanged attributes hidden)

      ~ scope {
            # (8 unchanged attributes hidden)

          ~ exclusions {
              ~ computer_group_ids  = [
                  - 126,
                    68,
                    # (1 unchanged element hidden)
                    123,
                  + 126,
                ]
                # (7 unchanged attributes hidden)
            }
        }

        # (1 unchanged block hidden)
    }

  # jamfpro_macos_configuration_profile.munki_shard_3 will be updated in-place
  ~ resource "jamfpro_macos_configuration_profile" "munki_shard_3" {
        id                  = "164"
        name                = "Munki - Shard 3"
        # (4 unchanged attributes hidden)

      ~ scope {
            # (8 unchanged attributes hidden)

          ~ exclusions {
              ~ computer_group_ids  = [
                  - 126,
                    68,
                    # (1 unchanged element hidden)
                    123,
                  + 126,
                ]
                # (7 unchanged attributes hidden)
            }
        }

        # (1 unchanged block hidden)
    }

  # jamfpro_macos_configuration_profile.munki_shard_4 will be updated in-place
  ~ resource "jamfpro_macos_configuration_profile" "munki_shard_4" {
        id                  = "167"
        name                = "Munki - Shard 4"
        # (4 unchanged attributes hidden)

      ~ scope {
            # (8 unchanged attributes hidden)

          ~ exclusions {
              ~ computer_group_ids  = [
                  - 126,
                    68,
                    # (1 unchanged element hidden)
                    123,
                  + 126,
                ]
                # (7 unchanged attributes hidden)
            }
        }

        # (1 unchanged block hidden)
    }

  # jamfpro_macos_configuration_profile.munki_shard_5 will be updated in-place
  ~ resource "jamfpro_macos_configuration_profile" "munki_shard_5" {
        id                  = "166"
        name                = "Munki - Shard 5"
        # (4 unchanged attributes hidden)

      ~ scope {
            # (8 unchanged attributes hidden)

          ~ exclusions {
              ~ computer_group_ids  = [
                  - 126,
                    68,
                    # (1 unchanged element hidden)
                    123,
                  + 126,
                ]
                # (7 unchanged attributes hidden)
            }
        }

        # (1 unchanged block hidden)
    }
thejoeker12 commented 4 months ago

Jamf will return in ascending order regardless of how we send them. Supressing this difference is tricky due to how TF Provider SDKv2 executes the diff suppress func and which args it provides.

It's on the list of things to fix in the future but for now, please wrap your id list in sort() to avoid having this issue.

computer_ids = sort([1, 3, 2])

w0de commented 4 months ago

Yes but then I have to write a module 😢