Skip to content

ilert_schedule and ilert_team produce recurring changes #98

@brainbug95

Description

@brainbug95

I set up an ilert_schedule like this

# recurring schedule
resource "ilert_schedule" "de_office-hours" {
  name     = "de-office-hours"
  timezone = "Europe/Berlin"
  type     = "RECURRING"
  schedule_layer {
    name      = "layer1"
    starts_on = "2025-01-01T00:00"
    user {
      id = ilert_user.hans_wurst.id
    }

    user {
      id = data.ilert_user.hein_bloed.id
    }

    rotation         = "P1D"
    restriction_type = "TIMES_OF_WEEK"

    restriction {
      from {
        day_of_week = "MONDAY"
        time        = "07:00"
      }
      to {
        day_of_week = "MONDAY"
        time        = "18:00"
      }
    }

    restriction {
      from {
        day_of_week = "TUESDAY"
        time        = "07:00"
      }
      to {
        day_of_week = "TUESDAY"
        time        = "18:00"
      }
    }

    restriction {
      from {
        day_of_week = "WEDNESDAY"
        time        = "07:00"
      }
      to {
        day_of_week = "WEDNESDAY"
        time        = "18:00"
      }
    }

    restriction {
      from {
        day_of_week = "THURSDAY"
        time        = "07:00"
      }
      to {
        day_of_week = "THURSDAY"
        time        = "18:00"
      }
    }

    restriction {
      from {
        day_of_week = "FRIDAY"
        time        = "07:00"
      }
      to {
        day_of_week = "FRIDAY"
        time        = "18:00"
      }
    }

  }
}

so far so good. But in any subsequent tofu apply this produces an alleged change:

OpenTofu will perform the following actions:

  # ilert_schedule.de_office-hours will be updated in-place
  ~ resource "ilert_schedule" "de_office-hours" {
        id        = "48153"
        name      = "de-office-hours"
        # (3 unchanged attributes hidden)

      ~ schedule_layer {
            name             = "layer1"
            # (3 unchanged attributes hidden)

          ~ restriction {
              ~ from {
                  ~ day_of_week = "THURSDAY" -> "MONDAY"
                    # (1 unchanged attribute hidden)
                }
              ~ to {
                  ~ day_of_week = "THURSDAY" -> "MONDAY"
                    # (1 unchanged attribute hidden)
                }
            }
          ~ restriction {
              ~ from {
                  ~ day_of_week = "WEDNESDAY" -> "TUESDAY"
                    # (1 unchanged attribute hidden)
                }
              ~ to {
                  ~ day_of_week = "WEDNESDAY" -> "TUESDAY"
                    # (1 unchanged attribute hidden)
                }
            }
          ~ restriction {
              ~ from {
                  ~ day_of_week = "FRIDAY" -> "WEDNESDAY"
                    # (1 unchanged attribute hidden)
                }
              ~ to {
                  ~ day_of_week = "FRIDAY" -> "WEDNESDAY"
                    # (1 unchanged attribute hidden)
                }
            }
          ~ restriction {
              ~ from {
                  ~ day_of_week = "MONDAY" -> "THURSDAY"
                    # (1 unchanged attribute hidden)
                }
              ~ to {
                  ~ day_of_week = "MONDAY" -> "THURSDAY"
                    # (1 unchanged attribute hidden)
                }
            }
          ~ restriction {
              ~ from {
                  ~ day_of_week = "TUESDAY" -> "FRIDAY"
                    # (1 unchanged attribute hidden)
                }
              ~ to {
                  ~ day_of_week = "TUESDAY" -> "FRIDAY"
                    # (1 unchanged attribute hidden)
                }
            }

            # (2 unchanged blocks hidden)
        }
    }

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

I had a similar issue with the ilert_team resource but here I managed to "fix" it by sorting my users within terraform code alphabetically. It would seem there is some sorting in place which is not accounted for within the terraform provider.

BR,
Christian

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions