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

[BUG] Default routing rule always showing changes for fields which are not required #415

Open
REBELinBLUE opened this issue Nov 10, 2023 · 6 comments

Comments

@REBELinBLUE
Copy link

REBELinBLUE commented Nov 10, 2023

Terraform Version

1.6.3 (also tried on 1.5.3)

Affected Resource(s)

opsgenie_team_routing_rule

Terraform Configuration Files

resource "opsgenie_team_routing_rule" "default" {
  name       = "Default Routing Rule"
  team_id    = opsgenie_team.this.id
  is_default = true

  order = 0

  criteria {
    type = "match-all"
  }

  notify {
    id   = opsgenie_escalation.default.id
    type = "escalation"
  }
}

Expected Behavior

Applying this multiple times should not show a change each time

Actual Behavior

After applying this, a subsequent plan says this

  ~ resource "opsgenie_team_routing_rule" "default" {
        id         = "f8af6d51-da2c-437d-bf23-02661337aa63"
        name       = "Default Routing Rule"
      - timezone   = "Europe/London" -> null
        # (3 unchanged attributes hidden)

      - time_restriction {
          - restriction {
              - end_hour   = 0 -> null
              - end_min    = 0 -> null
              - start_hour = 0 -> null
              - start_min  = 0 -> null
            }
        }

        # (2 unchanged blocks hidden)
    }

So I think well the API must be adding those, so I add to the terraform so it becomes

resource "opsgenie_team_routing_rule" "default" {
  name       = "Default Routing Rule"
  team_id    = opsgenie_team.this.id
  is_default = true

  order = 0

  criteria {
    type = "match-all"
  }

  notify {
    id   = opsgenie_escalation.default.id
    type = "escalation"
  }

  timezone = "Europe/London"

  time_restriction {
    restriction {
      end_hour   = 0
      end_min    = 0
      start_hour = 0
      start_min  = 0
    }
  }
}

and then apply but then get

│ Error: Missing required argument
│ 
│   on routing_rules.tf line 20, in resource "opsgenie_team_routing_rule" "default":
│   20:   time_restriction {
│ 
│ The argument "type" is required, but no definition was found.

so I add the type = "time-of-day" to the time_restriction but then get

╷
│ Error: Error occurred with Status code: 422, Message: Default routing rule can not be restricted to any time interval., Took: 0.008000, RequestId: 9d752b1b-4e93-41cf-8937-5578a03d4344
│ 
│   with opsgenie_team_routing_rule.default,
│   on routing_rules.tf line 1, in resource "opsgenie_team_routing_rule" "default":
│    1: resource "opsgenie_team_routing_rule" "default" {
│ 
╵

So there doesn't seem to be a way to manage reliably the default rule

@houseful-chisel
Copy link

Also seeing this. terraform_version 1.6.3, opsgenie provider version 0.6.34

@REBELinBLUE
Copy link
Author

For now I have "worked around" it with ignore_changes although obviously that isn't a brilliant solution

@mouhsen-ibrahim
Copy link

I'm having the same issue with terraform version v1.5.7 and opsGenie provider v0.6.34, for now I'm ignoring the changes in the plan, if I downgrade to version v0.6.33 of the provider the changes are gone

@cloud-pharaoh
Copy link

We are having the same issue with provider version 0.6.34 and TF version 1.5.7

@koushik-swaminathan
Copy link
Contributor

@REBELinBLUE will take a look at this issue, thank you!

@kpocius
Copy link

kpocius commented Jan 2, 2024

Looks like the issue got fixed via #413

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

6 participants