uptime-com / terraform-provider-uptime

A Terraform provider that provisions checks via the Uptime.com REST API
MIT License
20 stars 18 forks source link

Cannot set group-check uptime_percent_calculation to "AVERAGE" (fails on contact_groups) #87

Closed nabadger closed 1 month ago

nabadger commented 4 months ago

Hi,

We would like to use group-checks for reporting/UI purposes but not for alerting.

On the UI you can achieve this by setting the Group Behavior:

uptime-group-behavior

In terraform I would set something like:

uptime_percent_calculation = "AVERAGE"

However, to set this, we are not allowed to pass in any contact_groups. This should be supported as it's an optional.

This fails when contact groups is set to null or []

When I set it to null it appears to default contact groups to Default.

When I set it to [] it outputs a bug in the provider:

Error: Provider produced inconsistent result after apply
When applying changes to module.group_checks["My Group"].uptime_check_group.group_check, provider "provider[\"registry.terraform.io/uptime-com/uptime\"]" produced an unexpected new value: .contact_groups: length changed from 0 to 1.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

When it's set to [] it does appear to have issued the API to uptime.com and set the UI as one would expect, but the result of the terraform is still an error code.

gigovich commented 1 month ago

Hi @nabadger The fresh version (v2.9.0) fixes this issue. Example of correct usage:

resource "uptime_check_group" "test" {
  name   = var.name
  config = {
    uptime_percent_calculation = var.uptime_percent_calculation
  }
  contact_groups = []
}