Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ilert_schedule and ilert_team produce recurring changes #98

Open
brainbug95 opened this issue Jan 30, 2025 · 2 comments
Open

ilert_schedule and ilert_team produce recurring changes #98

brainbug95 opened this issue Jan 30, 2025 · 2 comments
Assignees

Comments

@brainbug95
Copy link

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

@STLVRTX
Copy link
Collaborator

STLVRTX commented Jan 30, 2025

Hello Christian, thanks for submitting this issue. I could reproduce your problem, we are already investigating the issue. I will post an update soon when we've decided on a solution.

@STLVRTX STLVRTX self-assigned this Jan 30, 2025
@brainbug95
Copy link
Author

brainbug95 commented Feb 4, 2025

Hi @STLVRTX

gleiches Problem bei "ilert_alert_action". Hier scheint die "alert_source" ebenfalls einer Sortierung zu unterliegen.

VG,
Christian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants