terraform-provider-opsgenie
terraform-provider-opsgenie copied to clipboard
Inconsistent variables (blocks) for `opsgenie_team_routing_rule`
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)
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
-
terraform apply
-
read the docs
you're a lifesaver. Thanks for pointing me into the right direction to resolve the error:
Error: startHour, startMin, endHour, endMin cannot be empty.