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

rotation_virtual_start constantly trying to change #168

Closed
yzargari opened this issue Nov 28, 2019 · 5 comments
Closed

rotation_virtual_start constantly trying to change #168

yzargari opened this issue Nov 28, 2019 · 5 comments

Comments

@yzargari
Copy link

Hello,

I've seen my problem reported in #4 and supposedly fixed in #1 over two years ago - but it looks like I'm still having the same issue with TF 0.12.12 and PD provider 1.3.1.

Essentially the problem is most likely related to having my account set with timezone of UTC+2 and my TF manifest is set by UTC. Terraform therefore thinks there's difference between what's set and what's need to be set and wants to change it - whereas, the "different" times are actually the same.

For example:

  ~ resource "pagerduty_schedule" "schedule_daytime" {
...
      ~ layer {
...
          ~ rotation_virtual_start       = "2019-01-01T02:00:00+02:00" -> "2019-01-01T00:00:00+00:00"

If I say yes to this, it will seemingly show a successful change:

pagerduty_schedule.schedule_daytime[0]: Modifying... [id=XXXXXXX]
pagerduty_schedule.schedule_daytime[0]: Modifications complete after 1s [id=XXXXXXX]

But then if I run terraform again, it will show the same modification to make:

  ~ resource "pagerduty_schedule" "schedule_daytime" {
...
      ~ layer {
...
          ~ rotation_virtual_start       = "2019-01-01T02:00:00+02:00" -> "2019-01-01T00:00:00+00:00"

Thanks,
Joseph

@iwasnobody
Copy link

@yzargari Did you solve this problem?

@iwasnobody
Copy link

It is related to your time_zone setting in terraform.
Set the rotation_virtual_start the same as your time_zone solve the problem.
For example: rotation_virtual_start = "2019-01-01T02:00:00+00:00"

@stmcallister
Copy link
Contributor

@iwasnobody Thanks for sharing your solution! I can update the docs to make this point more clear. Just to make sure I have your solution correct, you're saying that the rotation_virtual_start value needs to include the same timezone offset that you set in Terraform?

@iwasnobody
Copy link

@iwasnobody Thanks for sharing your solution! I can update the docs to make this point more clear. Just to make sure I have your solution correct, you're saying that the rotation_virtual_start value needs to include the same timezone offset that you set in Terraform?

rotation_virtual_start's timezone should be the same as time_zone setting. For example, I set the time_zone be Asia/shanghai, so the rotation_virtual_start need to be set +08:00

resource "pagerduty_schedule" "ivanyu_daytime" {
name = "Ivan.yu On Call Schedule-Daytime"
time_zone = "Asia/Shanghai"

layer {
name = "Daytime Shift"
start = "2020-04-08T20:00:00+08:00"
rotation_virtual_start = "2020-04-08T20:00:00+08:00"
rotation_turn_length_seconds = 86400
users = ["${data.pagerduty_user.ivanyu.id}"]

restriction {
  type              = "daily_restriction"
  start_time_of_day = "10:00:00"
  duration_seconds  = 43200
}

}
}

@stmcallister
Copy link
Contributor

PR #321 which was merged and included in v1.9.6 of the provider should have addressed this issue. The provider now compares the values of the timestamps in the schedule layer as Time objects rather than just strings. So, values that are equivalent, such as a UTC value and it's corresponding offset value should not be seen as a diff.

Going to close the issue. Please repost if that is not the case and we can investigate further.

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

3 participants