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

Inconsistent variables (blocks) for opsgenie_team_routing_rule #282

Open
Benbentwo opened this issue Dec 22, 2021 · 1 comment
Open

Inconsistent variables (blocks) for opsgenie_team_routing_rule #282

Benbentwo opened this issue Dec 22, 2021 · 1 comment

Comments

@Benbentwo
Copy link

Benbentwo commented Dec 22, 2021

Terraform Version

  • Terraform v1.0.9
  • Provider: opsgenie/opsgenie v0.6.7

Affected Resource(s)

  • opsgenie_team_routing_rule

Terraform Configuration Files

variable "name" {
  default = ""
}
variable "team_id" {
  default = ""
}
variable "time_restriction" {
  default = {}
}

resource "opsgenie_team_routing_rule" "this" {

  name    = var.name
  team_id = var.team_id

  time_restriction = {
    type = var.time_restriction.type

    dynamic "restrictions" {
      for_each = var.time_restriction.type == "weekday-and-time-of-day" ? try(var.time_restriction.restrictions, []) : []

      content {
        start_hour = 09
        start_min  = 0
        start_day  = "monday"
        end_hour   = 17
        end_min    = 00
        end_day    = "friday"
      }
    }
    dynamic "restriction" {
      for_each = var.time_restriction.type == "time-of-day" ? try(var.time_restriction.restrictions, []) : []
      content {
        start_hour = 09
        start_min  = 0
        end_hour   = 17
        end_min    = 00
      }
    }
  }
}

Expected Behavior

I should not need to declare two dynamic blocks for restriction and restrictions

I should be able to declare a single dynamic block for restriction(s) with optional values (or perhaps ignored - if day is passed to type "time-of-day")

If this is expected behavior, please update the examples so the terraform docs include that it is restriction for type "time-of-day" and not restrictions. (also the docs include timeRestriction which is incorrect)

docs link

Actual Behavior

I have to dig deep into the source of the provider to find documentation that "time-of-day" uses a different block entirely.

Steps to Reproduce

  1. terraform apply
  2. read the docs
@igaskin
Copy link
Contributor

igaskin commented Mar 14, 2022

you're a lifesaver. Thanks for pointing me into the right direction to resolve the error:

Error: startHour, startMin, endHour, endMin cannot be empty.

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